diff -Nru ssreflect-1.14.0/CHANGELOG.md ssreflect-1.15.0/CHANGELOG.md --- ssreflect-1.14.0/CHANGELOG.md 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/CHANGELOG.md 2022-06-30 08:50:47.000000000 +0000 @@ -1,10 +1,316 @@ # Changelog All notable changes to this project will be documented in this file. -Last releases: [[1.14.0] - 2022-01-19](#1140---2022-01-19), [[1.13.0] - 2021-10-28](#1130---2021-10-28) and [[1.12.0] - 2020-11-26](#1120---2020-11-26). +Last releases: [[1.15.0] - 2022-06-30](#1150---2022-06-30), [[1.14.0] - 2022-01-19](#1140---2022-01-19), [[1.13.0] - 2021-10-28](#1130---2021-10-28) and [[1.12.0] - 2020-11-26](#1120---2020-11-26). The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## [1.15.0] - 2022-06-30 + +This release is compatible with Coq versions 8.13, 8.14, 8.15 and 8.16. + +The contributors to this version are: +Cyril Cohen, ed-hermoreyes, Enrico Tassi, Erik Martin-Dorel, Evgenii Moiseenko, +Georges Gonthier, Jonathan Sterling, Kazuhiko Sakaguchi, Laurent Théry, +Mireia G. Bedmar, Pierre Jouvelot, Pierre Roux, Reynald Affeldt, +Wojciech Karpiel + +### Added + +- in `bigop.v` + + lemmas `leq_prod`,`telescope_big`, `telescope_sumn`, `telescope_sumn_in` + `leq_bigmax_seq`, `bigmax_leqP_seq`, `bigmax_sup_seq`, `eq_bigl_supp`, + `perm_big_supp_cond`, `perm_big_supp` + +- in `path.v` + + lemma `sortedP` + +- in `seq.v`, + + definitions `prefix`, `suffix`, `infix`, `infix_index` + + lemmas `nilpE`, `prefixE`, `prefix_refl`, `prefixs0`, `prefix0s`, + `prefix_cons`, `prefix_catr`, `prefix_prefix`, `prefixP`, `prefix_trans`, + `prefixs1`, `catl_prefix`, `prefix_catl`, `prefix_rcons`, `prefix_rev`, + `prefix_revLR`, `prefix1s`, `prefix_uniq`, `prefix_take`, `prefix_drop_gt0`, + `size_prefix`, `suffixE`, `suffix_refl`, `suffixs0`, `suffix0s`, + `suffix_rev`, `suffix_revLR`, `suffix_suffix`, `suffixP`, `suffix_trans`, + `suffix_rcons`, `suffix_catl`, `suffix_catr`, `catl_suffix`, `suffix_cons`, + `suffixW`, `suffix1s`, `suffix_uniq`, `suffix_drop`, `size_suffix`, + `infix0s`, `infixs0`, `infix_consl`, `infix_indexss`, `infix_index_le`, + `infixTindex`, `infixPn`, `infix_index0s`, `infix_indexs0`, `infixE`, + `infix_refl`, `prefixW`, `prefix_infix`, `infix_infix`, `suffix_infix`, + `infixP`, `infix_rev`, `infix_trans`, `infix_revLR`, `infix_rconsl`, + `infix_cons`, `infixs1`, `catl_infix`, `catr_infix`, `cons2_infix`, + `rcons2_infix`, `catr2_infix`, `catl2_infix`, `infix_catl`, `infix_catr`, + `prefix_infix_trans`, `suffix_infix_trans`, `infix_prefix_trans`, + `infix_suffix_trans`, `prefix_suffix_trans`, `suffix_prefix_trans`, + `infixW`, `mem_infix`, `infix1s`, `infix_rcons`, `infix_uniq`, + `infix_take`, `infix_drop`, `consr_infix`, `consl_infix`, `prefix_index`, + `size_infix`, `mkseqS`, `mkseq_uniqP`,`nth_seq1`, `set_nthE`, + `count_set_nth`, `count_set_nth_ltn`, `count_set_nthF`, `subseq_anti`, + `size_take_min`, `subseq_anti` + +- in `ssralg.v` + + notation `\- f` for definition `opp_fun` + + notation `f \* g` for definition `mul_fun` + + lemmas `opp_fun_is_additive` and `opp_fun_is_scalable` + + canonical instances `opp_fun_additive` and `opp_fun_linear` + + missing export for `eqr_div` + + number notation in scope ring_scope, numbers such as `12` or `42` + are now read as `12%:R` or `42%:R` + +- in `rat.v` + + Number Notation for numbers of the form `-? [0-9][0-9_]* ([.][0-9_]+)?` + in scope `rat_scope` (for instance 12%Q or 3.14%Q) + + lemma `rat_vm_compute` which is a specialization to the rewriting + rule `vm_compute` to trigger `vm_compute` by a rewrite + +- in `ssrint.v` + + number notation in scope int_scope, `12` or `-42` + are now read as `Posz 12` or `Negz 41` + + number notation in scope ring_scope, numbers such as `-12` are now + read as `(-12)%:~R` + +- in `fintype.v` + + lemmas `enum_ord0`, `enum_ordSl`, `enum_ordSr` + +- in `ssrbool.v` + + definition `pred_oapp` + + lemmas `all_sig2_cond`, `all_sig2_cond`, `can_in_pcan`, `pcan_in_inj`, + `in_inj_comp`, `can_in_comp`, `pcan_in_comp`, `ocan_in_comp`, `eqbLR`, + `eqbRL`, `homo_mono1` + +- in `choice.v` + + coercion `Choice.mixin` + +- in `eqtype.v` + + notations `eqbLHS` and `eqbRHS` + +- in `order.v` + + notations `leLHS`, `leRHS`, `ltLHS`, `ltRHS` + + notation `f \min g` and `f \max g` for definitions `min_fun` and `max_fun` + + lemma `le_le_trans` + +- in `ssrnat.v` + + notations `leqLHS`, `leqRHS`, `ltnLHS`, `ltnRHS` + + lemmas `geq_half_double`, `leq_uphalf_double` + +- in `ssrfun.v` + + definition `olift` + + lemmas `obindEapp`, `omapEbind`, `omapEapp`, `oappEmap`, `omap_comp`, + `oapp_comp`, `oapp_comp_f`, `olift_comp`, `compA`, `ocan_comp` + +- in `tuple.v` + + lemma `tuple_uniqP` + +- in `ssreflect.v`: + + typeclass `vm_compute_eq` and lemma `vm_compute` + in order to trigger a call to the tactic `vm_compute` when rewriting + using `rewrite [pattern]vm_compute` + + notation `[elaborate t]` forcing the elaboration of `t` using Coq's `refine` + tactic. This notation can be used in tandem with `have` to force type class + resolution when an explicit proof term `t` is provided (otherwise type + class instances are quantified implicitly by `have`) + +- in `ssrnum.v` + + lemmas `mulCii`, `ReE`, `ImE`, `conjCN1`, `CrealJ`, `eqCP`, + `eqC`, `ImM`, `ImMil`, `ReMil`, `ImMir`, `ReMir`, `ReM`, + `invC_Crect`, `ImV`, `ReV`, `rectC_mulr`, `rectC_mull`, + `divC_Crect`, `divC_rect`, `Im_div`, `Re_div` + + adding resolution of `'Re x \in Num.real` and `'Im x \in Num.real` + as in `Hint Extern` to `core` database + +- in `ssrnum.v` + + lemmas `gtr_opp`, `mulr_ge0_gt0`, `splitr`, `ler_addgt0Pr`, `ler_addgt0Pl`, + `lt_le`, `gt_ge` + +- in `interval.v` + + definition `miditv` + + lemmas `in_segment_addgt0Pr`, `in_segment_addgt0Pl`, `ltBSide`, + `leBSide`, `lteBSide`, `ltBRight_leBLeft`, `leBRight_ltBLeft`, + `bnd_simp`, `itv_splitU1`, `itv_split1U`, `mem_miditv`, + `miditv_le_left`, `miditv_ge_right`, `predC_itvl`, `predC_itvr`, + `predC_itv` + + coercion `pair_of_interval` + +### Changed + +- The following notations are now declared in `type_scope` + + `{tuple n of T}` and `{bseq n of T}` in `tuple.v` + + `{subset T}` and `{subset [d] T}` in `order.v` + + `{morphism D >-> T}` in `morphism.v` + + `{acts A, on S | to}` and `{acts A, on group G | to}` in `action.v` + + `{additive U -> V}`, `{rmorphism R -> S}`, `{linear U -> V}` + `{linear U -> V | s}`, `{scalar U}`, `{lrmorphism A -> B}` + `{lrmorphism A -> B | s}` in `ssralg.v` + + `{poly R}` in `poly.v` + + `{quot I}` and `{ideal_quot I}` in `ring_quotient.v` + + `{ratio T}` and `{fraction T}` in `fraction.v` + +- in `rat.v` + + `zeroq` and `oneq` (hence `0%Q` and `1%Q`) are now the evaluation + of terms `fracq (0, 1)` and `fracq (1, 1)` (and not the term + themselves), the old and new values are convertible and can be + easily converted with `rewrite -[0%Q]valqK -[1%Q]valqK` + +- in `order.v` + + fix `[distrLatticeType of T with disp]` notation + +- in `fintype.v` + + `enum_ordS` now a notation + +- in `gproduct.v` + + put notations `G ><| H`, `G \* H` and `G \x H` in `group_scope` + +- in `ssrnum.v` + + locked definitions `Re` and `Im` + +### Renamed + +- in `ssrbool.v` + + `mono2W_in` to `mono1W_in` (was misnamed) + +### Removed + +- in `ssrbool.v` + + notations `{pred T}`, `[rel _ | _]`, `[rel _ in _]`, `xrelpre` + (now in ssrbool in Coq) + + definitions `PredType`, `simpl_rel`, `SimplRel`, `relpre` + (now in ssrbool in Coq) + + coercion `rel_of_simpl_rel` deprecated for `rel_of_simpl` + (in ssrbool in Coq) + + lemmas `simpl_pred_sortE`, `homo_sym`, `mono_sym`, `homo_sym_in`, + `mono_sym_in`, `homo_sym_in11`, `mono_sym_in11`, `onW_can`, `onW_can_in`, + `in_onW_can`, `onS_can`, `onS_can_in`, `in_onS_can`, `homoRL_in`, + `homoLR_in`, `homo_mono_in`, `monoLR_in`, `monoRL_in`, `can_mono_in`, + `inj_can_sym_in_on`, `inj_can_sym_on`, `inj_can_sym_in`, `contra_not`, + `contraPnot`, `contraTnot`, `contraNnot`, `contraPT`, `contra_notT`, + `contra_notN`, `contraPN`, `contraFnot`, `contraPF`, `contra_notF` + (now in ssrbool in Coq, beware that `simpl_pred_sortE`, + `contra_not`, `contraPnot`, `contraTnot`, `contraNnot`, + `contraPT`, `contra_notT`, `contra_notN`, `contraPN`, + `contraFnot`, `contraPF`, `contra_notF` have different implicit + arguments and the order of arguments changes in `homoRL_in`, + `homoLR_in`, `homo_mono_in`, `monoLR_in`, `monoRL_in`, + `can_mono_in`) + +- in `ssreflect.v` + + structure `NonPropType.call_of`, constructor `Call` and field `callee` + (now in ssreflect in Coq) + + definitions `maybeProp`, `call` (now in ssreflect in Coq) + + structure `NonPropType.test_of`, constructor `Test` and field `condition` + (now in ssreflect in Coq, beware that implicit arguments of `condition` + differ) + + definitions `test_Prop`, `test_negative` (now in ssreflect in Coq) + + structure `NonPropType.type`, constructor `Check` and fields `result`, + `test`, `frame` (now in ssreflect in Coq, beware that implicit arguments + of `Check` differ) + + definition `check` (now in ssreflect in Coq, beware that implicit + arguments of `check` differ) + + notation `[apply]`, `[swap]`, `[dup]` in scope `ssripat_scope` + (now in ssreflect in Coq) + +- in `ssrfun.v` + + lemmas `Some_inj`, `of_voidK`, `inj_compr` (now in ssrfun in Coq, + beware that implicit arguments of `inj_compr` differ) + + notation `void` (now in ssrfun in Coq) + + definition `of_void` (now in ssrfun in Coq) + +- in `bigop.v` + + notation `big_uncond` + + notations `mulm_addl`, `mulm_addr`, `filter_index_enum` + +- in `ssrnat.v` + + notations `odd_add`, `odd_sub`, `iter_add`, `maxn_mulr`, `maxn_mull`, + `minn_mulr`, `minn_mull`, `odd_opp`, `odd_mul`, `odd_exp`, `sqrn_sub` + +- in `seq.v` + + notations `take_addn`, `rot_addn`, `nseq_addn`, `allpairs_catr`, + `allpairs_consr`, `perm_allpairs_rconsr`, `iota_addl` + +- in `fintype.v` + + notations `arg_minP`, `arg_maxP`, `bump_addl`, `unbump_addl`, + `disjoint_trans` + +- in `perm.v` + + notations `tuple_perm_eqP`, `pcycle`, `pcycles`, `mem_pcycle`, `pcycle_id`, + `uniq_traject_pcycle`, `pcycle_traject`, `iter_pcycle`, `eq_pcycle_mem`, + `pcycle_sym`, `pcycle_perm`, `ncycles_mul_tperm` + +- in `classfun.v` + + notation `cf_triangle_lerif` + +- in `action.v` + + notations `pcycleE`, `pcycle_actperm` + +- in `prime.v` + + notations `primes_mul`, `primes_exp`, `pnat_mul`, `pnat_exp` + +- in `path.v` + + notations `sorted_lt_nth`, `sorted_le_nth`, `ltn_index`, `leq_index`, + `subseq_order_path` + +- in `div.v` + + notations `coprime_mull`, `coprime_mulr`, `coprime_expl`, `coprime_expr` + +- in `vector.v` + + notation `limg_add` + +- in `ssrint.v` + + notation `polyC_mulrz` + +- in `poly.v` + + notations `polyC_add`, `polyC_opp`, `polyC_sub`, `polyC_muln`, `polyC_mul`, + `polyC_inv`, `lead_coef_opp`, `derivn_sub` + +- in `polydiv.v` + + notations `rdivp_addl`, `rdivp_addr`, `rmodp_add`, `dvdp_scalel`, + `dvdp_scaler`, `dvdp_opp`, `coprimep_scalel`, `coprimep_scaler`, + `coprimep_mull`, `coprimep_mulr`, `modp_scalel`, `modp_scaler`, `modp_opp`, + `modp_add`, `divp_scalel`, `divp_scaler`, `divp_opp`, `divp_add`, + `modp_scalel`, `modp_scaler`, `modp_opp`, `modp_add`, `divp_scalel`, + `divp_scaler`, `divp_opp`, `divp_add` + +- in `mxalgebra.v` + + notations `mulsmx_addl`, `mulsmx_addr` + +- in `matrix.v` + + notations `scalar_mx_comm`, `map_mx_sub` + +- in `interval.v` + + notations `@ 'lersif'`, `lersif`, `x <= y ?< 'if' b`, `subr_lersifr0`, + `subr_lersif0r`, `subr_lersif0`, `lersif_trans`, `lersif01`, `lersif_anti`, + `lersifxx`, `lersifNF`, `lersifS`, `lersifT`, `lersifF`, `lersif_oppl`, + `lersif_oppr`, `lersif_0oppr`, `lersif_oppr0`, `lersif_opp2`, `lersif_oppE`, + `lersif_add2l`, `lersif_add2r`, `lersif_add2`, `lersif_subl_addr`, + `lersif_subr_addr`, `lersif_sub_addr`, `lersif_subl_addl`, + `lersif_subr_addl`, `lersif_sub_addl`, `lersif_andb`, `lersif_orb`, + `lersif_imply`, `lersifW`, `ltrW_lersif`, `lersif_pmul2l`, `lersif_pmul2r`, + `lersif_nmul2l`, `lersif_nmul2r`, `real_lersifN`, `real_lersif_norml`, + `real_lersif_normr`, `lersif_nnormr`, `lersifN`, `lersif_norml`, + `lersif_normr`, `lersif_distl`, `lersif_minr`, `lersif_minl`, `lersif_maxr`, + `lersif_maxl`, `lersif_pdivl_mulr`, `lersif_pdivr_mulr`, + `lersif_pdivl_mull`, `lersif_pdivr_mull`, `lersif_ndivl_mulr`, + `lersif_ndivr_mulr`, `lersif_ndivl_mull`, `lersif_ndivr_mull`, + `lersif_in_itv`, `itv_gte`, `ltr_in_itv`, `ler_in_itv`, `itv_splitU2`, + `@ 'itv_intersection'`, `itv_intersection`, `@ 'itv_intersection1i'`, + `itv_intersection1i`, `@ 'itv_intersectioni1'`, `itv_intersectioni1`, + `@ 'itv_intersectionii'`, `itv_intersectionii`, `@ 'itv_intersectionC'`, + `itv_intersectionC`, `@ 'itv_intersectionA'`, `itv_intersectionA` + +- in `intdiv.v` + + notations `coprimez_mull`, `coprimez_mulr`, `coprimez_expl`, `coprimez_expr` + +### Infrastructure + +- in `builddoc_lib.sh`: + + change the sed command that removes all starred lines + +### Misc + +- fix warning `deprecated-hint-without-locality` by adding the `#[global]` + attribute to most hints +- turn warning `deprecated-hint-without-locality` into an error + ## [1.14.0] - 2022-01-19 This release is compatible with Coq versions 8.11, 8.12, 8.13, 8.14, and 8.15. diff -Nru ssreflect-1.14.0/CHANGELOG_UNRELEASED.md ssreflect-1.15.0/CHANGELOG_UNRELEASED.md --- ssreflect-1.14.0/CHANGELOG_UNRELEASED.md 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/CHANGELOG_UNRELEASED.md 2022-06-30 08:50:47.000000000 +0000 @@ -19,3 +19,4 @@ ### Infrastructure ### Misc + diff -Nru ssreflect-1.14.0/CONTRIBUTING.md ssreflect-1.15.0/CONTRIBUTING.md --- ssreflect-1.14.0/CONTRIBUTING.md 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/CONTRIBUTING.md 2022-06-30 08:50:47.000000000 +0000 @@ -85,7 +85,7 @@ (see [`ssrbool.v`](https://github.com/coq/coq/blob/master/theories/ssr/ssrbool.v)) ### Naming of variables -- Variable/hypohteses names follow the following conventions. +- Variable/hypothesis names follow the following conventions. + Hypothesis should not be named `H`, `H'`,... (these collide with subgroup variable conventions) but have meaningful names. For example, an hypothesis `n > 0` should be named `n_gt0`. @@ -95,9 +95,9 @@ + Polynomials should be named by lower case letter `p`, `q`, `r` ... (to avoid collision with properties named `P`, `Q`, ...) + Matrices should be named `A`, `B`, ..., `M`, `N`, ... + Polymorphic variables should be named `x`, ... -- Variables/hypohteses that do not survive the line can be introduced using `?`. -- Variables/hypohteses with a very short scope (~ 1-5 lines) can have a short name. -- Variables/hypohteses with a longer scope (> 5 lines) must have a meaningful name. +- Variables/hypotheses that do not survive the line can be introduced using `?`. +- Variables/hypotheses with a very short scope (~ 1-5 lines) can have a short name. +- Variables/hypotheses with a longer scope (> 5 lines) must have a meaningful name. ### Naming conventions for lemmas (non exhaustive) #### Names in the library usually obey one of the following conventions diff -Nru ssreflect-1.14.0/coq-mathcomp-algebra.opam ssreflect-1.15.0/coq-mathcomp-algebra.opam --- ssreflect-1.14.0/coq-mathcomp-algebra.opam 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/coq-mathcomp-algebra.opam 2022-06-30 08:50:47.000000000 +0000 @@ -7,7 +7,7 @@ dev-repo: "git+https://github.com/math-comp/math-comp.git" license: "CECILL-B" -build: [ make "-C" "mathcomp/algebra" "-j" "%{jobs}%" "COQEXTRAFLAGS+=-native-compiler yes" {coq-native:installed & coq:version < "8.13~" } ] +build: [ make "-C" "mathcomp/algebra" "-j" "%{jobs}%" ] install: [ make "-C" "mathcomp/algebra" "install" ] depends: [ "coq-mathcomp-fingroup" { = version } ] diff -Nru ssreflect-1.14.0/coq-mathcomp-character.opam ssreflect-1.15.0/coq-mathcomp-character.opam --- ssreflect-1.14.0/coq-mathcomp-character.opam 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/coq-mathcomp-character.opam 2022-06-30 08:50:47.000000000 +0000 @@ -7,7 +7,7 @@ dev-repo: "git+https://github.com/math-comp/math-comp.git" license: "CECILL-B" -build: [ make "-C" "mathcomp/character" "-j" "%{jobs}%" "COQEXTRAFLAGS+=-native-compiler yes" {coq-native:installed & coq:version < "8.13~" } ] +build: [ make "-C" "mathcomp/character" "-j" "%{jobs}%" ] install: [ make "-C" "mathcomp/character" "install" ] depends: [ "coq-mathcomp-field" { = version } ] diff -Nru ssreflect-1.14.0/coq-mathcomp-field.opam ssreflect-1.15.0/coq-mathcomp-field.opam --- ssreflect-1.14.0/coq-mathcomp-field.opam 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/coq-mathcomp-field.opam 2022-06-30 08:50:47.000000000 +0000 @@ -7,7 +7,7 @@ dev-repo: "git+https://github.com/math-comp/math-comp.git" license: "CECILL-B" -build: [ make "-C" "mathcomp/field" "-j" "%{jobs}%" "COQEXTRAFLAGS+=-native-compiler yes" {coq-native:installed & coq:version < "8.13~" } ] +build: [ make "-C" "mathcomp/field" "-j" "%{jobs}%" ] install: [ make "-C" "mathcomp/field" "install" ] depends: [ "coq-mathcomp-solvable" { = version } ] diff -Nru ssreflect-1.14.0/coq-mathcomp-fingroup.opam ssreflect-1.15.0/coq-mathcomp-fingroup.opam --- ssreflect-1.14.0/coq-mathcomp-fingroup.opam 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/coq-mathcomp-fingroup.opam 2022-06-30 08:50:47.000000000 +0000 @@ -7,7 +7,7 @@ dev-repo: "git+https://github.com/math-comp/math-comp.git" license: "CECILL-B" -build: [ make "-C" "mathcomp/fingroup" "-j" "%{jobs}%" "COQEXTRAFLAGS+=-native-compiler yes" {coq-native:installed & coq:version < "8.13~" } ] +build: [ make "-C" "mathcomp/fingroup" "-j" "%{jobs}%" ] install: [ make "-C" "mathcomp/fingroup" "install" ] depends: [ "coq-mathcomp-ssreflect" { = version } ] diff -Nru ssreflect-1.14.0/coq-mathcomp-solvable.opam ssreflect-1.15.0/coq-mathcomp-solvable.opam --- ssreflect-1.14.0/coq-mathcomp-solvable.opam 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/coq-mathcomp-solvable.opam 2022-06-30 08:50:47.000000000 +0000 @@ -7,7 +7,7 @@ dev-repo: "git+https://github.com/math-comp/math-comp.git" license: "CECILL-B" -build: [ make "-C" "mathcomp/solvable" "-j" "%{jobs}%" "COQEXTRAFLAGS+=-native-compiler yes" {coq-native:installed & coq:version < "8.13~" } ] +build: [ make "-C" "mathcomp/solvable" "-j" "%{jobs}%" ] install: [ make "-C" "mathcomp/solvable" "install" ] depends: [ "coq-mathcomp-algebra" { = version } ] diff -Nru ssreflect-1.14.0/coq-mathcomp-ssreflect.opam ssreflect-1.15.0/coq-mathcomp-ssreflect.opam --- ssreflect-1.14.0/coq-mathcomp-ssreflect.opam 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/coq-mathcomp-ssreflect.opam 2022-06-30 08:50:47.000000000 +0000 @@ -7,9 +7,9 @@ dev-repo: "git+https://github.com/math-comp/math-comp.git" license: "CECILL-B" -build: [ make "-C" "mathcomp/ssreflect" "-j" "%{jobs}%" "COQEXTRAFLAGS+=-native-compiler yes" {coq-native:installed & coq:version < "8.13~" } ] +build: [ make "-C" "mathcomp/ssreflect" "-j" "%{jobs}%" ] install: [ make "-C" "mathcomp/ssreflect" "install" ] -depends: [ "coq" { ((>= "8.11" & < "8.16~") | (= "dev"))} ] +depends: [ "coq" { ((>= "8.13" & < "8.16~") | (= "dev"))} ] tags: [ "keyword:small scale reflection" "keyword:mathematical components" "keyword:odd order theorem" "logpath:mathcomp.ssreflect" ] authors: [ "Jeremy Avigad <>" "Andrea Asperti <>" "Stephane Le Roux <>" "Yves Bertot <>" "Laurence Rideau <>" "Enrico Tassi <>" "Ioana Pasca <>" "Georges Gonthier <>" "Sidi Ould Biha <>" "Cyril Cohen <>" "Francois Garillot <>" "Alexey Solovyev <>" "Russell O'Connor <>" "Laurent Théry <>" "Assia Mahboubi <>" ] diff -Nru ssreflect-1.14.0/_CoqProject ssreflect-1.15.0/_CoqProject --- ssreflect-1.14.0/_CoqProject 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/_CoqProject 2022-06-30 08:50:47.000000000 +0000 @@ -7,5 +7,5 @@ -arg -w -arg +duplicate-clear -arg -w -arg +non-primitive-record -arg -w -arg +undeclared-scope --arg -w -arg -deprecated-hint-without-locality --arg -w -arg -deprecated-hint-rewrite-without-locality +-arg -w -arg +deprecated-hint-without-locality +-arg -w -arg +deprecated-hint-rewrite-without-locality diff -Nru ssreflect-1.14.0/debian/changelog ssreflect-1.15.0/debian/changelog --- ssreflect-1.14.0/debian/changelog 2022-06-12 12:00:32.000000000 +0000 +++ ssreflect-1.15.0/debian/changelog 2022-07-05 06:55:31.000000000 +0000 @@ -1,3 +1,10 @@ +ssreflect (1.15.0-1) unstable; urgency=medium + + * New upstream release. + * Rewrite the autopkgtest. + + -- Julien Puydt Tue, 05 Jul 2022 08:55:31 +0200 + ssreflect (1.14.0-12) unstable; urgency=medium * Use dh-coq. diff -Nru ssreflect-1.14.0/debian/tests/control ssreflect-1.15.0/debian/tests/control --- ssreflect-1.14.0/debian/tests/control 2022-06-12 12:00:32.000000000 +0000 +++ ssreflect-1.15.0/debian/tests/control 2022-07-05 06:55:31.000000000 +0000 @@ -1,2 +1,2 @@ -Tests: loadssreflect +Test-Command: coqtop -batch -rifrom mathcomp ssreflect Depends: @, coq diff -Nru ssreflect-1.14.0/debian/tests/loadssreflect ssreflect-1.15.0/debian/tests/loadssreflect --- ssreflect-1.14.0/debian/tests/loadssreflect 2022-06-12 12:00:32.000000000 +0000 +++ ssreflect-1.15.0/debian/tests/loadssreflect 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -#!/bin/sh - -set -e - -outdir=${ADT_ARTIFACTS-/tmp/ssreflect} -indir="debian/tests" -input="loadssreflect.v" -mkdir -p ${outdir} -cp ${indir}/${input} ${outdir} -cd ${outdir} -coqc ${input} 2> /dev/null diff -Nru ssreflect-1.14.0/debian/tests/loadssreflect.v ssreflect-1.15.0/debian/tests/loadssreflect.v --- ssreflect-1.14.0/debian/tests/loadssreflect.v 2022-06-12 12:00:32.000000000 +0000 +++ ssreflect-1.15.0/debian/tests/loadssreflect.v 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -From Coq Require Import ssreflect ssrfun ssrbool. diff -Nru ssreflect-1.14.0/Dockerfile ssreflect-1.15.0/Dockerfile --- ssreflect-1.14.0/Dockerfile 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/Dockerfile 2022-06-30 08:50:47.000000000 +0000 @@ -1,16 +1,20 @@ ARG coq_image="coqorg/coq:dev" +# hadolint ignore=DL3006 FROM ${coq_image} as builder +ENV MATHCOMP_VERSION="dev" +ENV MATHCOMP_PACKAGE="coq-mathcomp-character" + WORKDIR /home/coq/mathcomp COPY . . -RUN ["/bin/bash", "--login", "-c", "set -x \ - && [ -n \"${COMPILER_EDGE}\" ] \ - && opam switch set \"${COMPILER_EDGE}\" \ +SHELL ["/bin/bash", "--login", "-o", "pipefail", "-c"] + +# hadolint ignore=SC2046,DL3004 +RUN set -x \ + && opam switch \ && eval $(opam env) \ - && [ -n \"${COMPILER}\" ] \ - && opam switch remove -y \"${COMPILER}\" \ && opam repository add --all-switches --set-default coq-extra-dev https://coq.inria.fr/opam/extra-dev \ && opam repository add --all-switches --set-default coq-core-dev https://coq.inria.fr/opam/core-dev \ && opam update -y \ @@ -22,14 +26,10 @@ && opam pin add -n -k path coq-mathcomp-solvable . \ && opam pin add -n -k path coq-mathcomp-field . \ && opam pin add -n -k path coq-mathcomp-character . \ - && opam install -y -v -j ${NJOBS} coq-mathcomp-character \ - && opam clean -a -c -s --logs"] - -FROM coqorg/base:bare - -ENV COMPILER="" -ENV MATHCOMP_VERSION="dev" -ENV MATHCOMP_PACKAGE="coq-mathcomp-character" - -COPY --from=builder --chown=coq:coq /home/coq/.opam /home/coq/.opam -COPY --from=builder --chown=coq:coq /home/coq/.profile /home/coq/.profile + && opam install -y -v -j "${NJOBS}" "${MATHCOMP_PACKAGE}" \ + && opam clean -a -c -s --logs \ + && opam config list && opam list + +# Restore default shell to fully preserve backward compatibility +SHELL ["/bin/sh", "-c"] +# Still, we may remove this line later on. diff -Nru ssreflect-1.14.0/Dockerfile.make ssreflect-1.15.0/Dockerfile.make --- ssreflect-1.14.0/Dockerfile.make 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/Dockerfile.make 2022-06-30 08:50:47.000000000 +0000 @@ -1,24 +1,28 @@ ARG coq_image="coqorg/coq:dev" +# hadolint ignore=DL3006 FROM ${coq_image} WORKDIR /home/coq/mathcomp COPY . . -RUN ["/bin/bash", "--login", "-c", "set -x \ - && [ -n \"${COMPILER_EDGE}\" ] \ - && opam switch set \"${COMPILER_EDGE}\" \ +SHELL ["/bin/bash", "--login", "-o", "pipefail", "-c"] + +# hadolint ignore=SC2046,DL3004 +RUN set -x \ + && opam switch \ && eval $(opam env) \ - && [ -n \"${COMPILER}\" ] \ - && opam switch remove -y \"${COMPILER}\" \ && opam repository add --all-switches --set-default coq-extra-dev https://coq.inria.fr/opam/extra-dev \ && opam repository add --all-switches --set-default coq-core-dev https://coq.inria.fr/opam/core-dev \ && opam update -y \ && opam config list && opam repo list && opam list && coqc --version \ && opam clean -a -c -s --logs \ && sudo chown -R coq:coq /home/coq/mathcomp \ - && cd mathcomp \ - && make Makefile.coq \ - && make -f Makefile.coq -j ${NJOBS} all \ - && make -f Makefile.coq install \ - && make test-suite"] + && make -C mathcomp Makefile.coq \ + && make -C mathcomp -f Makefile.coq -j "${NJOBS}" all \ + && make -C mathcomp -f Makefile.coq install \ + && make -C mathcomp test-suite + +# Restore default shell to fully preserve backward compatibility +SHELL ["/bin/sh", "-c"] +# Still, we may remove this line later on. diff -Nru ssreflect-1.14.0/.dockerignore ssreflect-1.15.0/.dockerignore --- ssreflect-1.14.0/.dockerignore 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/.dockerignore 2022-06-30 08:50:47.000000000 +0000 @@ -2,6 +2,7 @@ # Begin files referenced by symlinks !README.md !AUTHORS +!INITIAL_AUTHORS.md !INSTALL.md !CeCILL-B # End files referenced by symlinks diff -Nru ssreflect-1.14.0/etc/utils/builddoc_lib.sh ssreflect-1.15.0/etc/utils/builddoc_lib.sh --- ssreflect-1.14.0/etc/utils/builddoc_lib.sh 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/etc/utils/builddoc_lib.sh 2022-06-30 08:50:47.000000000 +0000 @@ -15,7 +15,7 @@ # to a if not EOF :a; N; $!ba; # remove all starred lines - s/\(\*{5,}?\)//g; + s/\(\*{5,}+\)//g; # remove *)\n(* s/\*+\)\n\(\*+/\n/g; diff -Nru ssreflect-1.14.0/mathcomp/algebra/fraction.v ssreflect-1.15.0/mathcomp/algebra/fraction.v --- ssreflect-1.14.0/mathcomp/algebra/fraction.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/algebra/fraction.v 2022-06-30 08:50:47.000000000 +0000 @@ -69,7 +69,7 @@ End FracDomain. -Notation "{ 'ratio' T }" := (ratio_of (Phant T)). +Notation "{ 'ratio' T }" := (ratio_of (Phant T)) : type_scope. Identity Coercion type_fracdomain_of : ratio_of >-> ratio. Notation "'\n_' x" := (frac x).1 @@ -112,7 +112,7 @@ Definition type := {eq_quot equivf}. Definition type_of of phant R := type. -Notation "{ 'fraction' T }" := (type_of (Phant T)). +Notation "{ 'fraction' T }" := (type_of (Phant T)) : type_scope. (* we recover some structure for the quotient *) Canonical frac_quotType := [quotType of type]. @@ -159,8 +159,8 @@ Proof. move=> x y; unlock add; apply/eqmodP; rewrite /= equivfE /addf /=. rewrite !numden_Ratio ?mulf_neq0 ?domP // mulrDr mulrDl; apply/eqP. -symmetry; rewrite (AC (2*2)%AC (3*1*2*4)%AC) (AC (2*2)%AC (3*2*1*4)%AC)/=. -by rewrite !equivf_l (ACl ((2*3)*(1*4))%AC) (ACl ((2*3)*(4*1))%AC)/=. +symmetry; rewrite (AC (2*2) (3*1*2*4)) (AC (2*2) (3*2*1*4))/=. +by rewrite !equivf_l (ACl ((2*3)*(1*4))) (ACl ((2*3)*(4*1)))/=. Qed. Canonical pi_add_morph := PiMorph2 pi_add. @@ -248,8 +248,8 @@ Proof. elim/quotW=> x; elim/quotW=> y; elim/quotW=> z; apply/eqP. rewrite !piE /equivf /mulf /addf !numden_Ratio ?mulf_neq0 ?domP //; apply/eqP. -rewrite !(mulrDr, mulrDl) (AC (3*(2*2))%AC (4*2*7*((1*3)*(6*5)))%AC)/=. -by rewrite [X in _ + X](AC (3*(2*2))%AC (4*6*7*((1*3)*(2*5)))%AC)/=. +rewrite !(mulrDr, mulrDl) (AC (3*(2*2)) (4*2*7*((1*3)*(6*5))))/=. +by rewrite [X in _ + X](AC (3*(2*2)) (4*6*7*((1*3)*(2*5))))/=. Qed. Lemma nonzero1 : 1%:F != 0%:F :> type. @@ -294,7 +294,7 @@ Notation "{ 'fraction' T }" := (FracField.type_of (Phant T)). Notation equivf := (@FracField.equivf _). -Hint Resolve denom_ratioP : core. +#[global] Hint Resolve denom_ratioP : core. Section Canonicals. @@ -341,7 +341,7 @@ Lemma tofrac_is_additive: additive tofrac. Proof. move=> p q /=; unlock tofrac. -rewrite -[X in _ = _ + X]pi_opp -[X in _ = X]pi_add. +rewrite -[X in _ = _ + X]pi_opp -[RHS]pi_add. by rewrite /addf /oppf /= !numden_Ratio ?(oner_neq0, mul1r, mulr1). Qed. @@ -349,7 +349,7 @@ Lemma tofrac_is_multiplicative: multiplicative tofrac. Proof. -split=> [p q|//]; unlock tofrac; rewrite -[X in _ = X]pi_mul. +split=> [p q|//]; unlock tofrac; rewrite -[RHS]pi_mul. by rewrite /mulf /= !numden_Ratio ?(oner_neq0, mul1r, mulr1). Qed. diff -Nru ssreflect-1.14.0/mathcomp/algebra/intdiv.v ssreflect-1.15.0/mathcomp/algebra/intdiv.v --- ssreflect-1.14.0/mathcomp/algebra/intdiv.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/algebra/intdiv.v 2022-06-30 08:50:47.000000000 +0000 @@ -334,7 +334,7 @@ Lemma dvdz_mulr d m n : (d %| m)%Z -> (d %| m * n)%Z. Proof. by move=> d_m; rewrite mulrC dvdz_mull. Qed. -Hint Resolve dvdz0 dvd1z dvdzz dvdz_mull dvdz_mulr : core. +#[global] Hint Resolve dvdz0 dvd1z dvdzz dvdz_mull dvdz_mulr : core. Lemma dvdz_mul d1 d2 m1 m2 : (d1 %| m1 -> d2 %| m2 -> d1 * d2 %| m1 * m2)%Z. Proof. by rewrite !dvdzE !abszM; apply: dvdn_mul. Qed. @@ -986,10 +986,10 @@ exists (xrow i 0 L); first by rewrite xrowE unitmx_mul unitmx_perm. exists R => //; exists d; rewrite //= xrowE -!mulmxA (mulmxA L) -dM xrowE. by rewrite mulmxA -perm_mxM tperm2 perm_mx1 mul1mx. -without loss /forallP a_dvM0: / [forall j, a %| M 0 j]%Z. +without loss /forallP a_dvM0: / [forall j, a %| M 0%R j]%Z. case: (altP forallP) => [_ IH|/forallPn/sigW/IHa IH _]; exact: IH. without loss{Da a_dvM0} Da: M / forall j, M 0 j = a. - pose Uur := col' 0 (\row_j (1 - (M 0 j %/ a)%Z)). + pose Uur := col' 0 (\row_j (1 - (M 0%R j %/ a)%Z)). pose U : 'M_(1 + n) := block_mx 1 Uur 0 1%:M; pose M1 := M *m U. have uU: U \in unitmx by rewrite unitmxE det_ublock !det1 mulr1. case/(_ (M *m U)) => [j | L uL [R uR [d dvD dM]]]. @@ -1112,12 +1112,3 @@ by apply: (row_free_inj uT); rewrite mul1mx mulmxKpV. by move=> i; rewrite mulmx1 -map_mxM 2!mxE denq_int mxE. Qed. - -#[deprecated(since="mathcomp 1.12.0", note="Use coprimezMl instead.")] -Notation coprimez_mull := coprimezMl (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use coprimezMr instead.")] -Notation coprimez_mulr := coprimezMr (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use coprimezXl instead.")] -Notation coprimez_expl := coprimezXl (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use coprimezXr instead.")] -Notation coprimez_expr := coprimezXr (only parsing). diff -Nru ssreflect-1.14.0/mathcomp/algebra/interval.v ssreflect-1.15.0/mathcomp/algebra/interval.v --- ssreflect-1.14.0/mathcomp/algebra/interval.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/algebra/interval.v 2022-06-30 08:50:47.000000000 +0000 @@ -13,6 +13,9 @@ (* \in can be used to test membership. *) (* itvP x_in_i == where x_in_i has type x \in i, if i is ground, *) (* gives a set of rewrite rules that x_in_i imply. *) +(* lteBSide, bnd_simp == multirules to simplify inequalities between interval *) +(* bounds *) +(* miditv i == middle point of interval i *) (* *) (* Intervals of T form an partially ordered type (porderType) whose ordering *) (* is the subset relation. If T is a lattice, intervals also form a lattice *) @@ -56,6 +59,9 @@ Notation "'+oo'" := (BInfty _ false) (at level 0) : order_scope. Variant interval (T : Type) := Interval of itv_bound T & itv_bound T. +Coercion pair_of_interval T (I : interval T) : itv_bound T * itv_bound T := + let: Interval b1 b2 := I in (b1, b2). + (* We provide the 9 following notations to help writing formal intervals *) Notation "`[ a , b ]" := (Interval (BLeft a) (BRight b)) (at level 0, a, b at level 9 , format "`[ a , b ]") : order_scope. @@ -229,6 +235,60 @@ Lemma lt_ninfty b : (b < -oo) = false. Proof. by case: b => // -[]. Qed. +Lemma ltBSide x y (b b' : bool) : + BSide b x < BSide b' y = (x < y ?<= if b && ~~ b'). +Proof. by []. Qed. + +Lemma leBSide x y (b b' : bool) : + BSide b x <= BSide b' y = (x < y ?<= if b' ==> b). +Proof. by []. Qed. + +Definition lteBSide := (ltBSide, leBSide). + +Lemma ltBRight_leBLeft b x : b < BRight x = (b <= BLeft x). +Proof. by move: b => [[] b|[]]. Qed. +Lemma leBRight_ltBLeft b x : BRight x <= b = (BLeft x < b). +Proof. by move: b => [[] b|[]]. Qed. + +Let BLeft_ltE x y (b : bool) : BSide b x < BLeft y = (x < y). +Proof. by case: b. Qed. +Let BRight_leE x y (b : bool) : BSide b x <= BRight y = (x <= y). +Proof. by case: b. Qed. +Let BRight_BLeft_leE x y : BRight x <= BLeft y = (x < y). +Proof. by []. Qed. +Let BLeft_BRight_ltE x y : BLeft x < BRight y = (x <= y). +Proof. by []. Qed. +Let BRight_BSide_ltE x y (b : bool) : BRight x < BSide b y = (x < y). +Proof. by case: b. Qed. +Let BLeft_BSide_leE x y (b : bool) : BLeft x <= BSide b y = (x <= y). +Proof. by case: b. Qed. +Let BSide_ltE x y (b : bool) : BSide b x < BSide b y = (x < y). +Proof. by case: b. Qed. +Let BSide_leE x y (b : bool) : BSide b x <= BSide b y = (x <= y). +Proof. by case: b. Qed. +Let BInfty_leE a : a <= BInfty T false. Proof. by case: a => [[] a|[]]. Qed. +Let BInfty_geE a : BInfty T true <= a. Proof. by case: a => [[] a|[]]. Qed. +Let BInfty_le_eqE a : BInfty T false <= a = (a == BInfty T false). +Proof. by case: a => [[] a|[]]. Qed. +Let BInfty_ge_eqE a : a <= BInfty T true = (a == BInfty T true). +Proof. by case: a => [[] a|[]]. Qed. +Let BInfty_ltE a : a < BInfty T false = (a != BInfty T false). +Proof. by case: a => [[] a|[]]. Qed. +Let BInfty_gtE a : BInfty T true < a = (a != BInfty T true). +Proof. by case: a => [[] a|[]]. Qed. +Let BInfty_ltF a : BInfty T false < a = false. +Proof. by case: a => [[] a|[]]. Qed. +Let BInfty_gtF a : a < BInfty T true = false. +Proof. by case: a => [[] a|[]]. Qed. +Let BInfty_BInfty_ltE : BInfty T true < BInfty T false. Proof. by []. Qed. + +Definition bnd_simp := (BLeft_ltE, BRight_leE, + BRight_BLeft_leE, BLeft_BRight_ltE, + BRight_BSide_ltE, BLeft_BSide_leE, BSide_ltE, BSide_leE, + BInfty_leE, BInfty_geE, BInfty_BInfty_ltE, + BInfty_le_eqE, BInfty_ge_eqE, BInfty_ltE, BInfty_gtE, BInfty_ltF, BInfty_gtF, + @lexx _ T, @ltxx _ T, @eqxx T). + Definition subitv i1 i2 := let: Interval b1l b1r := i1 in let: Interval b2l b2r := i2 in (b2l <= b1l) && (b1r <= b2r). @@ -397,6 +457,20 @@ Arguments itvP [x i]. +Lemma itv_splitU1 b x : b <= BLeft x -> + Interval b (BRight x) =i [predU1 x & Interval b (BLeft x)]. +Proof. +move=> bx z; rewrite !inE/= !subitvE ?bnd_simp//= lt_neqAle. +by case: (eqVneq z x) => [->|]//=; rewrite lexx bx. +Qed. + +Lemma itv_split1U b x : BRight x <= b -> + Interval (BLeft x) b =i [predU1 x & Interval (BRight x) b]. +Proof. +move=> bx z; rewrite !inE/= !subitvE ?bnd_simp//= lt_neqAle. +by case: (eqVneq z x) => [->|]//=; rewrite lexx bx. +Qed. + End IntervalPOrder. Section IntervalLattice. @@ -537,7 +611,7 @@ Section IntervalTotal. Variable (disp : unit) (T : orderType disp). -Implicit Types (x y z : T) (i : interval T). +Implicit Types (a b c : itv_bound T) (x y z : T) (i : interval T). Lemma itv_bound_totalMixin : totalLatticeMixin [latticeType of itv_bound T]. Proof. by move=> [[]?|[]][[]?|[]]; rewrite /<=%O //=; case: ltgtP. Qed. @@ -614,6 +688,21 @@ - by case: leP b13r (lt_trans b23r b12r). Qed. +Lemma predC_itvl a : [predC Interval -oo a] =i Interval a +oo. +Proof. +case: a => [b x|[]//] y. +by rewrite !inE !subitvE/= bnd_simp andbT !lteBSide/= lteifNE negbK. +Qed. + +Lemma predC_itvr a : [predC Interval a +oo] =i Interval -oo a. +Proof. by move=> y; rewrite inE/= -predC_itvl negbK. Qed. + +Lemma predC_itv i : [predC i] =i [predU Interval -oo i.1 & Interval i.2 +oo]. +Proof. +case: i => [a a']; move=> x; rewrite inE/= itv_splitI negb_and. +by symmetry; rewrite inE/= -predC_itvl -predC_itvr. +Qed. + End IntervalTotal. Local Open Scope ring_scope. @@ -649,13 +738,23 @@ Lemma oppr_itvcc (a b x : R) : (- x \in `[a, b]) = (x \in `[(- b), (- a)]). Proof. exact: oppr_itv. Qed. +Definition miditv (R : numDomainType) (i : interval R) : R := + match i with + | Interval (BSide _ a) (BSide _ b) => (a + b) / 2%:R + | Interval -oo%O (BSide _ b) => b - 1 + | Interval (BSide _ a) +oo%O => a + 1 + | Interval -oo%O +oo%O => 0 + | _ => 0 + end. + End IntervalNumDomain. Section IntervalField. Variable R : numFieldType. +Implicit Types (x y z : R) (i : interval R). -Local Notation mid x y := ((x + y) / 2%:R). +Local Notation mid x y := ((x + y) / 2). Lemma mid_in_itv : forall ba bb (xa xb : R), xa < xb ?<= if ba && ~~ bb -> mid xa xb \in Interval (BSide ba xa) (BSide bb xb). @@ -669,435 +768,39 @@ Lemma mid_in_itvcc : forall (xa xb : R), xa <= xb -> mid xa xb \in `[xa, xb]. Proof. by move=> xa xb ?; apply: mid_in_itv. Qed. -End IntervalField. - -(******************************************************************************) -(* Compatibility layer *) -(******************************************************************************) - -Module mc_1_11. - -Local Notation lersif x y b := (Order.lteif x y (~~ b)) (only parsing). - -Local Notation "x <= y ?< 'if' b" := (x < y ?<= if ~~ b) - (at level 70, y at next level, only parsing) : ring_scope. - -Section LersifPo. - -Variable R : numDomainType. -Implicit Types (b : bool) (x y z : R). - -Lemma subr_lersifr0 b (x y : R) : (y - x <= 0 ?< if b) = (y <= x ?< if b). -Proof. exact: subr_lteifr0. Qed. - -Lemma subr_lersif0r b (x y : R) : (0 <= y - x ?< if b) = (x <= y ?< if b). -Proof. exact: subr_lteif0r. Qed. - -Definition subr_lersif0 := (subr_lersifr0, subr_lersif0r). - -Lemma lersif_trans x y z b1 b2 : - x <= y ?< if b1 -> y <= z ?< if b2 -> x <= z ?< if b1 || b2. -Proof. by rewrite negb_or; exact: lteif_trans. Qed. - -Lemma lersif01 b : (0 : R) <= 1 ?< if b. Proof. exact: lteif01. Qed. - -Lemma lersif_anti b1 b2 x y : - (x <= y ?< if b1) && (y <= x ?< if b2) = - if b1 || b2 then false else x == y. -Proof. by rewrite lteif_anti -negb_or; case: orb. Qed. - -Lemma lersifxx x b : (x <= x ?< if b) = ~~ b. Proof. exact: lteifxx. Qed. - -Lemma lersifNF x y b : y <= x ?< if ~~ b -> x <= y ?< if b = false. -Proof. exact: lteifNF. Qed. - -Lemma lersifS x y b : x < y -> x <= y ?< if b. -Proof. exact: lteifS. Qed. - -Lemma lersifT x y : x <= y ?< if true = (x < y). Proof. by []. Qed. - -Lemma lersifF x y : x <= y ?< if false = (x <= y). Proof. by []. Qed. - -Lemma lersif_oppl b x y : - x <= y ?< if b = (- y <= x ?< if b). -Proof. exact: lteif_oppl. Qed. - -Lemma lersif_oppr b x y : x <= - y ?< if b = (y <= - x ?< if b). -Proof. exact: lteif_oppr. Qed. - -Lemma lersif_0oppr b x : 0 <= - x ?< if b = (x <= 0 ?< if b). -Proof. exact: lteif_0oppr. Qed. - -Lemma lersif_oppr0 b x : - x <= 0 ?< if b = (0 <= x ?< if b). -Proof. exact: lteif_oppr0. Qed. - -Lemma lersif_opp2 b : {mono (-%R : R -> R) : x y /~ x <= y ?< if b}. -Proof. exact: lteif_opp2. Qed. - -Definition lersif_oppE := (lersif_0oppr, lersif_oppr0, lersif_opp2). - -Lemma lersif_add2l b x : {mono +%R x : y z / y <= z ?< if b}. -Proof. exact: lteif_add2l. Qed. - -Lemma lersif_add2r b x : {mono +%R^~ x : y z / y <= z ?< if b}. -Proof. exact: lteif_add2r. Qed. - -Definition lersif_add2 := (lersif_add2l, lersif_add2r). - -Lemma lersif_subl_addr b x y z : (x - y <= z ?< if b) = (x <= z + y ?< if b). -Proof. exact: lteif_subl_addr. Qed. - -Lemma lersif_subr_addr b x y z : (x <= y - z ?< if b) = (x + z <= y ?< if b). -Proof. exact: lteif_subr_addr. Qed. - -Definition lersif_sub_addr := (lersif_subl_addr, lersif_subr_addr). - -Lemma lersif_subl_addl b x y z : (x - y <= z ?< if b) = (x <= y + z ?< if b). -Proof. exact: lteif_subl_addl. Qed. - -Lemma lersif_subr_addl b x y z : (x <= y - z ?< if b) = (z + x <= y ?< if b). -Proof. exact: lteif_subr_addl. Qed. - -Definition lersif_sub_addl := (lersif_subl_addl, lersif_subr_addl). - -Lemma lersif_andb x y : - {morph (fun b => lersif x y b) : p q / p || q >-> p && q}. -Proof. by move=> ? ?; rewrite negb_or lteif_andb. Qed. - -Lemma lersif_orb x y : - {morph (fun b => lersif x y b) : p q / p && q >-> p || q}. -Proof. by move=> ? ?; rewrite negb_and lteif_orb. Qed. - -Lemma lersif_imply b1 b2 (r1 r2 : R) : - b2 ==> b1 -> r1 <= r2 ?< if b1 -> r1 <= r2 ?< if b2. -Proof. by move=> ?; apply: lteif_imply; rewrite implybNN. Qed. - -Lemma lersifW b x y : x <= y ?< if b -> x <= y. -Proof. exact: lteifW. Qed. - -Lemma ltrW_lersif b x y : x < y -> x <= y ?< if b. -Proof. exact: ltrW_lteif. Qed. - -Lemma lersif_pmul2l b x : 0 < x -> {mono *%R x : y z / y <= z ?< if b}. -Proof. exact: lteif_pmul2l. Qed. - -Lemma lersif_pmul2r b x : 0 < x -> {mono *%R^~ x : y z / y <= z ?< if b}. -Proof. exact: lteif_pmul2r. Qed. - -Lemma lersif_nmul2l b x : x < 0 -> {mono *%R x : y z /~ y <= z ?< if b}. -Proof. exact: lteif_nmul2l. Qed. - -Lemma lersif_nmul2r b x : x < 0 -> {mono *%R^~ x : y z /~ y <= z ?< if b}. -Proof. exact: lteif_nmul2r. Qed. - -Lemma real_lersifN x y b : x \is Num.real -> y \is Num.real -> - x <= y ?< if ~~b = ~~ (y <= x ?< if b). -Proof. exact: real_lteifNE. Qed. - -Lemma real_lersif_norml b x y : - x \is Num.real -> - (`|x| <= y ?< if b) = ((- y <= x ?< if b) && (x <= y ?< if b)). -Proof. exact: real_lteif_norml. Qed. - -Lemma real_lersif_normr b x y : - y \is Num.real -> - (x <= `|y| ?< if b) = ((x <= y ?< if b) || (x <= - y ?< if b)). -Proof. exact: real_lteif_normr. Qed. - -Lemma lersif_nnormr b x y : y <= 0 ?< if ~~ b -> (`|x| <= y ?< if b) = false. -Proof. exact: lteif_nnormr. Qed. - -End LersifPo. - -Section LersifOrdered. - -Variable (R : realDomainType) (b : bool) (x y z e : R). - -Lemma lersifN : (x <= y ?< if ~~ b) = ~~ (y <= x ?< if b). -Proof. exact: lteifNE. Qed. - -Lemma lersif_norml : - (`|x| <= y ?< if b) = (- y <= x ?< if b) && (x <= y ?< if b). -Proof. exact: lteif_norml. Qed. - -Lemma lersif_normr : - (x <= `|y| ?< if b) = (x <= y ?< if b) || (x <= - y ?< if b). -Proof. exact: lteif_normr. Qed. - -Lemma lersif_distl : - (`|x - y| <= e ?< if b) = (y - e <= x ?< if b) && (x <= y + e ?< if b). -Proof. exact: lteif_distl. Qed. - -Lemma lersif_minr : - (x <= Num.min y z ?< if b) = (x <= y ?< if b) && (x <= z ?< if b). -Proof. exact: lteif_minr. Qed. - -Lemma lersif_minl : - (Num.min y z <= x ?< if b) = (y <= x ?< if b) || (z <= x ?< if b). -Proof. exact: lteif_minl. Qed. - -Lemma lersif_maxr : - (x <= Num.max y z ?< if b) = (x <= y ?< if b) || (x <= z ?< if b). -Proof. exact: lteif_maxr. Qed. - -Lemma lersif_maxl : - (Num.max y z <= x ?< if b) = (y <= x ?< if b) && (z <= x ?< if b). -Proof. exact: lteif_maxl. Qed. - -End LersifOrdered. - -Section LersifField. - -Variable (F : numFieldType) (b : bool) (z x y : F). - -Lemma lersif_pdivl_mulr : 0 < z -> x <= y / z ?< if b = (x * z <= y ?< if b). -Proof. exact: lteif_pdivl_mulr. Qed. - -Lemma lersif_pdivr_mulr : 0 < z -> y / z <= x ?< if b = (y <= x * z ?< if b). -Proof. exact: lteif_pdivr_mulr. Qed. - -Lemma lersif_pdivl_mull : 0 < z -> x <= z^-1 * y ?< if b = (z * x <= y ?< if b). -Proof. exact: lteif_pdivl_mull. Qed. - -Lemma lersif_pdivr_mull : 0 < z -> z^-1 * y <= x ?< if b = (y <= z * x ?< if b). -Proof. exact: lteif_pdivr_mull. Qed. - -Lemma lersif_ndivl_mulr : z < 0 -> x <= y / z ?< if b = (y <= x * z ?< if b). -Proof. exact: lteif_ndivl_mulr. Qed. - -Lemma lersif_ndivr_mulr : z < 0 -> y / z <= x ?< if b = (x * z <= y ?< if b). -Proof. exact: lteif_ndivr_mulr. Qed. - -Lemma lersif_ndivl_mull : z < 0 -> x <= z^-1 * y ?< if b = (y <=z * x ?< if b). -Proof. exact: lteif_ndivl_mull. Qed. - -Lemma lersif_ndivr_mull : z < 0 -> z^-1 * y <= x ?< if b = (z * x <= y ?< if b). -Proof. exact: lteif_ndivr_mull. Qed. - -End LersifField. - -Section IntervalPo. - -Variable R : numDomainType. - -Implicit Types (x xa xb : R). - -Lemma lersif_in_itv ba bb xa xb x : - x \in Interval (BSide ba xa) (BSide bb xb) -> xa <= xb ?< if ~~ ba || bb. -Proof. by move/lt_in_itv; rewrite negb_or negbK. Qed. - -Lemma itv_gte ba xa bb xb : - xb <= xa ?< if ba && ~~ bb -> Interval (BSide ba xa) (BSide bb xb) =i pred0. -Proof. by move=> ?; apply: itv_ge; rewrite /<%O /= lteifNF. Qed. - -Lemma ltr_in_itv ba bb xa xb x : - ~~ ba || bb -> x \in Interval (BSide ba xa) (BSide bb xb) -> xa < xb. -Proof. by move=> bab /lersif_in_itv; rewrite bab. Qed. +Lemma mem_miditv i : (i.1 < i.2)%O -> miditv i \in i. +Proof. +move: i => [[ba a|[]] [bb b|[]]] //= ab; first exact: mid_in_itv. +by rewrite !in_itv -lteif_subl_addl subrr lteif01. +by rewrite !in_itv lteif_subl_addr -lteif_subl_addl subrr lteif01. +Qed. -Lemma ler_in_itv ba bb xa xb x : - x \in Interval (BSide ba xa) (BSide bb xb) -> xa <= xb. -Proof. by move/lt_in_itv/lteifW. Qed. +Lemma miditv_le_left i b : (i.1 < i.2)%O -> (BSide b (miditv i) <= i.2)%O. +Proof. +case: i => [x y] lti; have := mem_miditv lti; rewrite inE => /andP[_ ]. +by apply: le_trans; rewrite !bnd_simp. +Qed. -End IntervalPo. +Lemma miditv_ge_right i b : (i.1 < i.2)%O -> (i.1 <= BSide b (miditv i))%O. +Proof. +case: i => [x y] lti; have := mem_miditv lti; rewrite inE => /andP[+ _]. +by move=> /le_trans; apply; rewrite !bnd_simp. +Qed. -Lemma itv_splitU2 (R : realDomainType) (x : R) a b : - x \in Interval a b -> - forall y, y \in Interval a b = - [|| y \in Interval a (BLeft x), y == x | y \in Interval (BRight x) b]. -Proof. exact: itv_splitUeq. Qed. +Lemma in_segment_addgt0Pr x y z : + reflect (forall e, e > 0 -> y \in `[x - e, z + e]) (y \in `[x, z]). +Proof. +apply/(iffP idP)=> [xyz e /[dup] e_gt0 /ltW e_ge0 | xyz_e]. + by rewrite in_itv /= ler_subl_addr !ler_paddr// (itvP xyz). +by rewrite in_itv /= ; apply/andP; split; apply/ler_addgt0Pr => ? /xyz_e; + rewrite in_itv /= ler_subl_addr => /andP []. +Qed. -End mc_1_11. +Lemma in_segment_addgt0Pl x y z : + reflect (forall e, e > 0 -> y \in `[(- e + x), (e + z)]) (y \in `[x, z]). +Proof. +apply/(equivP (in_segment_addgt0Pr x y z)). +by split=> zxy e /zxy; rewrite [z + _]addrC [_ + x]addrC. +Qed. -#[deprecated(since="mathcomp 1.12.0", note="Use Order.lteif instead.")] -Notation "@ 'lersif'" := - (fun (R : numDomainType) x y b => @Order.lteif _ R x y (~~ b)) - (at level 10, only parsing). - -#[deprecated(since="mathcomp 1.12.0", note="Use Order.lteif instead.")] -Notation lersif := (fun x y b => @Order.lteif _ _ x y (~~ b)) (only parsing). - -#[deprecated(since="mathcomp 1.12.0", note="Use [_ < _ ?<= if _] instead.")] -Notation "x <= y ?< 'if' b" := - (x < y ?<= if ~~ b) (at level 70, y at next level, only parsing) : ring_scope. - -(* LersifPo *) - -#[deprecated(since="mathcomp 1.12.0", note="Use subr_lteifr0 instead.")] -Notation subr_lersifr0 := mc_1_11.subr_lersifr0 (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use subr_lteif0r instead.")] -Notation subr_lersif0r := mc_1_11.subr_lersif0r (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use subr_lteif0 instead.")] -Notation subr_lersif0 := mc_1_11.subr_lersif0 (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_trans instead.")] -Notation lersif_trans := mc_1_11.lersif_trans (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif01 instead.")] -Notation lersif01 := mc_1_11.lersif01 (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_anti instead.")] -Notation lersif_anti := mc_1_11.lersif_anti (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteifxx instead.")] -Notation lersifxx := mc_1_11.lersifxx (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteifNF instead.")] -Notation lersifNF := mc_1_11.lersifNF (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteifS instead.")] -Notation lersifS := mc_1_11.lersifS (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteifT instead.")] -Notation lersifT := mc_1_11.lersifT (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteifF instead.")] -Notation lersifF := mc_1_11.lersifF (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_oppl instead.")] -Notation lersif_oppl := mc_1_11.lersif_oppl (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_oppr instead.")] -Notation lersif_oppr := mc_1_11.lersif_oppr (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_0oppr instead.")] -Notation lersif_0oppr := mc_1_11.lersif_0oppr (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_oppr0 instead.")] -Notation lersif_oppr0 := mc_1_11.lersif_oppr0 (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_opp2 instead.")] -Notation lersif_opp2 := mc_1_11.lersif_opp2 (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_oppE instead.")] -Notation lersif_oppE := mc_1_11.lersif_oppE (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_add2l instead.")] -Notation lersif_add2l := mc_1_11.lersif_add2l (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_add2r instead.")] -Notation lersif_add2r := mc_1_11.lersif_add2r (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_add2 instead.")] -Notation lersif_add2 := mc_1_11.lersif_add2 (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_subl_addr instead.")] -Notation lersif_subl_addr := mc_1_11.lersif_subl_addr (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_subr_addr instead.")] -Notation lersif_subr_addr := mc_1_11.lersif_subr_addr (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_sub_addr instead.")] -Notation lersif_sub_addr := mc_1_11.lersif_sub_addr (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lersif_subl_addl instead.")] -Notation lersif_subl_addl := mc_1_11.lersif_subl_addl (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lersif_subr_addl instead.")] -Notation lersif_subr_addl := mc_1_11.lersif_subr_addl (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lersif_sub_addl instead.")] -Notation lersif_sub_addl := mc_1_11.lersif_sub_addl (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_andb instead.")] -Notation lersif_andb := mc_1_11.lersif_andb (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_orb instead.")] -Notation lersif_orb := mc_1_11.lersif_orb (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_imply instead.")] -Notation lersif_imply := mc_1_11.lersif_imply (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteifW instead.")] -Notation lersifW := mc_1_11.lersifW (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use ltrW_lteif instead.")] -Notation ltrW_lersif := mc_1_11.ltrW_lersif (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_pmul2l instead.")] -Notation lersif_pmul2l := mc_1_11.lersif_pmul2l (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_pmul2r instead.")] -Notation lersif_pmul2r := mc_1_11.lersif_pmul2r (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_nmul2l instead.")] -Notation lersif_nmul2l := mc_1_11.lersif_nmul2l (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_nmul2r instead.")] -Notation lersif_nmul2r := mc_1_11.lersif_nmul2r (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use real_lteifNE instead.")] -Notation real_lersifN := mc_1_11.real_lersifN (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use real_lteif_norml instead.")] -Notation real_lersif_norml := mc_1_11.real_lersif_norml (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use real_lteif_normr instead.")] -Notation real_lersif_normr := mc_1_11.real_lersif_normr (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_nnormr instead.")] -Notation lersif_nnormr := mc_1_11.lersif_nnormr (only parsing). - -(* LersifOrdered *) - -#[deprecated(since="mathcomp 1.12.0", note="Use lteifNE instead.")] -Notation lersifN := mc_1_11.lersifN (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_norml instead.")] -Notation lersif_norml := mc_1_11.lersif_norml (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_normr instead.")] -Notation lersif_normr := mc_1_11.lersif_normr (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_distl instead.")] -Notation lersif_distl := mc_1_11.lersif_distl (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_minr instead.")] -Notation lersif_minr := mc_1_11.lersif_minr (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_minl instead.")] -Notation lersif_minl := mc_1_11.lersif_minl (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_maxr instead.")] -Notation lersif_maxr := mc_1_11.lersif_maxr (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_maxl instead.")] -Notation lersif_maxl := mc_1_11.lersif_maxl (only parsing). - -(* LersifField *) - -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_pdivl_mulr instead.")] -Notation lersif_pdivl_mulr := mc_1_11.lersif_pdivl_mulr (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_pdivr_mulr instead.")] -Notation lersif_pdivr_mulr := mc_1_11.lersif_pdivr_mulr (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_pdivl_mull instead.")] -Notation lersif_pdivl_mull := mc_1_11.lersif_pdivl_mull (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_pdivr_mull instead.")] -Notation lersif_pdivr_mull := mc_1_11.lersif_pdivr_mull (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_ndivl_mulr instead.")] -Notation lersif_ndivl_mulr := mc_1_11.lersif_ndivl_mulr (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_ndivr_mulr instead.")] -Notation lersif_ndivr_mulr := mc_1_11.lersif_ndivr_mulr (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_ndivl_mull instead.")] -Notation lersif_ndivl_mull := mc_1_11.lersif_ndivl_mull (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_ndivr_mull instead.")] -Notation lersif_ndivr_mull := mc_1_11.lersif_ndivr_mull (only parsing). - -(* IntervalPo *) - -#[deprecated(since="mathcomp 1.12.0", note="Use lteif_in_itv instead.")] -Notation lersif_in_itv := mc_1_11.lersif_in_itv (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use itv_ge instead.")] -Notation itv_gte := mc_1_11.itv_gte (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lt_in_itv instead.")] -Notation ltr_in_itv := mc_1_11.ltr_in_itv (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lt_in_itv instead.")] -Notation ler_in_itv := @mc_1_11.ler_in_itv (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use itv_splitUeq instead.")] -Notation itv_splitU2 := mc_1_11.itv_splitU2 (only parsing). - -(* `itv_intersection` accepts any `numDomainType` but `Order.meet` accepts *) -(* only `realDomainType`. *) -#[deprecated(since="mathcomp 1.12.0", note="Use Order.meet instead.")] -Notation "@ 'itv_intersection'" := - (fun (R : realDomainType) => @Order.meet _ [latticeType of interval R]) - (at level 10, only parsing) : fun_scope. -#[deprecated(since="mathcomp 1.12.0", note="Use Order.meet instead.")] -Notation itv_intersection := - (@Order.meet _ [latticeType of interval (_ : realDomainType)]) (only parsing). - -#[deprecated(since="mathcomp 1.12.0", note="Use meet1x instead.")] -Notation "@ 'itv_intersection1i'" := - (fun (R : realDomainType) => @meet1x _ [tbLatticeType of interval R]) - (at level 10, only parsing) : fun_scope. -#[deprecated(since="mathcomp 1.12.0", note="Use meet1x instead.")] -Notation itv_intersection1i := - (@meet1x _ [tbLatticeType of interval (_ : realDomainType)]) (only parsing). - -#[deprecated(since="mathcomp 1.12.0", note="Use meetx1 instead.")] -Notation "@ 'itv_intersectioni1'" := - (fun (R : realDomainType) => @meetx1 _ [tbLatticeType of interval R]) - (at level 10, only parsing) : fun_scope. -#[deprecated(since="mathcomp 1.12.0", note="Use meetx1 instead.")] - Notation itv_intersectioni1 := - (@meetx1 _ [tbLatticeType of interval (_ : realDomainType)]) (only parsing). - -#[deprecated(since="mathcomp 1.12.0", note="Use meetxx instead.")] -Notation "@ 'itv_intersectionii'" := - (fun _ (R : realDomainType) => @meetxx _ [latticeType of interval R]) - (at level 10, only parsing) : fun_scope. -#[deprecated(since="mathcomp 1.12.0", note="Use meetxx instead.")] -Notation itv_intersectionii := - (@meetxx _ [latticeType of interval (_ : realDomainType)]) (only parsing). - -(* IntervalOrdered *) -#[deprecated(since="mathcomp 1.12.0", note="Use meetC instead.")] -Notation "@ 'itv_intersectionC'" := - (fun (R : realDomainType) => @meetC _ [latticeType of interval R]) - (at level 10, only parsing) : fun_scope. -#[deprecated(since="mathcomp 1.12.0", note="Use meetC instead.")] -Notation itv_intersectionC := - (@meetC _ [latticeType of interval (_ : realDomainType)]) (only parsing). - -#[deprecated(since="mathcomp 1.12.0", note="Use meetA instead.")] -Notation "@ 'itv_intersectionA'" := - (fun (R : realDomainType) => @meetA _ [latticeType of interval R]) - (at level 10, only parsing) : fun_scope. -#[deprecated(since="mathcomp 1.12.0", note="Use meetA instead.")] -Notation itv_intersectionA := - (@meetA _ [latticeType of interval (_ : realDomainType)]) (only parsing). +End IntervalField. diff -Nru ssreflect-1.14.0/mathcomp/algebra/Make ssreflect-1.15.0/mathcomp/algebra/Make --- ssreflect-1.14.0/mathcomp/algebra/Make 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/algebra/Make 2022-06-30 08:50:47.000000000 +0000 @@ -26,5 +26,3 @@ -arg -w -arg +duplicate-clear -arg -w -arg -ambiguous-paths -arg -w -arg +undeclared-scope --arg -w -arg -deprecated-hint-without-locality --arg -w -arg -deprecated-ident-entry diff -Nru ssreflect-1.14.0/mathcomp/algebra/matrix.v ssreflect-1.15.0/mathcomp/algebra/matrix.v --- ssreflect-1.14.0/mathcomp/algebra/matrix.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/algebra/matrix.v 2022-06-30 08:50:47.000000000 +0000 @@ -1217,7 +1217,7 @@ by move=> u; apply/rowP=> k; case/mxvec_indexP: k => i j; rewrite mxvecE mxE. Qed. -Lemma curry_mxvec_bij : {on 'I_(m * n), bijective (prod_curry mxvec_index)}. +Lemma curry_mxvec_bij : {on 'I_(m * n), bijective (uncurry mxvec_index)}. Proof. exists (enum_val \o cast_ord (esym mxvec_cast)) => [[i j] _ | k _] /=. by rewrite cast_ordK enum_rankK. @@ -2705,13 +2705,13 @@ Arguments is_scalar_mxP {R n A}. Arguments mul_delta_mx {R m n p}. -Hint Extern 0 (is_true (is_diag_mx (scalar_mx _))) => +#[global] Hint Extern 0 (is_true (is_diag_mx (scalar_mx _))) => apply: scalar_mx_is_diag : core. -Hint Extern 0 (is_true (is_trig_mx (scalar_mx _))) => +#[global] Hint Extern 0 (is_true (is_trig_mx (scalar_mx _))) => apply: scalar_mx_is_trig : core. -Hint Extern 0 (is_true (is_diag_mx (diag_mx _))) => +#[global] Hint Extern 0 (is_true (is_diag_mx (diag_mx _))) => apply: diag_mx_is_diag : core. -Hint Extern 0 (is_true (is_trig_mx (diag_mx _))) => +#[global] Hint Extern 0 (is_true (is_trig_mx (diag_mx _))) => apply: diag_mx_is_trig : core. Notation "a %:M" := (scalar_mx a) : ring_scope. @@ -3253,10 +3253,7 @@ Canonical matrix_finAlgType (R : finComRingType) n' := [finAlgType R of 'M[R]_n'.+1]. -Hint Resolve comm_mx_scalar comm_scalar_mx : core. - -#[deprecated(since="mathcomp 1.12.0", note="Use comm_mx_scalar instead.")] -Notation scalar_mx_comm := comm_mx_scalar (only parsing). +#[global] Hint Resolve comm_mx_scalar comm_scalar_mx : core. (*****************************************************************************) (********************** Matrix unit ring and inverse matrices ****************) @@ -3809,9 +3806,6 @@ End mxRingOver. End mxOver. -#[deprecated(since="mathcomp 1.12.0", note="Use map_mxB instead.")] -Notation map_mx_sub := map_mxB (only parsing). - Section BlockMatrix. Import tagnat. Context {T : Type} {p q : nat} {p_ : 'I_p -> nat} {q_ : 'I_q -> nat}. diff -Nru ssreflect-1.14.0/mathcomp/algebra/mxalgebra.v ssreflect-1.15.0/mathcomp/algebra/mxalgebra.v --- ssreflect-1.14.0/mathcomp/algebra/mxalgebra.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/algebra/mxalgebra.v 2022-06-30 08:50:47.000000000 +0000 @@ -2217,7 +2217,7 @@ End RowSpaceTheory. -Hint Resolve submx_refl : core. +#[global] Hint Resolve submx_refl : core. Arguments submxP {F m1 m2 n A B}. Arguments eq_row_sub [F m n v A]. Arguments row_subP {F m1 m2 n A B}. @@ -3096,11 +3096,6 @@ End MapMatrixSpaces. -#[deprecated(since="mathcomp 1.12.0", note="Use mulsmxDl instead.")] -Notation mulsmx_addl := mulsmxDl (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use mulsmxDr instead.")] -Notation mulsmx_addr := mulsmxDr (only parsing). - Section RowColDiagBlockMatrix. Import tagnat. Context {F : fieldType} {n : nat} {p_ : 'I_n -> nat}. diff -Nru ssreflect-1.14.0/mathcomp/algebra/mxpoly.v ssreflect-1.15.0/mathcomp/algebra/mxpoly.v --- ssreflect-1.14.0/mathcomp/algebra/mxpoly.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/algebra/mxpoly.v 2022-06-30 08:50:47.000000000 +0000 @@ -218,7 +218,7 @@ pose Ss0_ i dj := \poly_(j < dj) S i (insubd j0 j). pose Ss_ dj := \matrix_(i, j) (if j == j0 then Ss0_ i dj else (S i j)%:P). have{Ss u} ->: Ss = Ss_ dS. - apply/matrixP=> i j; rewrite mxE [in X in _ = X]mxE; case: (j == j0) => {j}//. + apply/matrixP=> i j; rewrite mxE [in RHS]mxE; case: (j == j0) => {j}//. apply/polyP=> k; rewrite coef_poly Sylvester_mxE mxE. have [k_ge_dS | k_lt_dS] := leqP dS k. case: (split i) => {}i; rewrite !mxE coefMXn; @@ -242,7 +242,7 @@ have [dj0 | dj_gt0] := posnP dj; rewrite ?dj0 !mul1r. rewrite !det_tr det_map_mx addrC (expand_det_col _ j0) big1 => [|i _]. rewrite add0r; congr (\det _)%:P. - apply/matrixP=> i j; rewrite [in X in _ = X]mxE; case: eqP => // ->. + apply/matrixP=> i j; rewrite [in RHS]mxE; case: eqP => // ->. by congr (S i _); apply: val_inj. by rewrite mxE /= [Ss0_ _ _]poly_def big_ord0 mul0r. have /determinant_alternate->: j1 != j0 by rewrite -val_eqE -lt0n. @@ -1783,7 +1783,7 @@ by exists D0; apply/simmxW. exists (\mxrow_i tag (DoA i)); apply/simmxW. rewrite -row_leq_rank eqmx_col (mxdirectP Vd)/=. - by under [X in (_ <= X)%N]eq_bigr do rewrite genmxE (eqP (rAV _)). + by under [leqRHS]eq_bigr do rewrite genmxE (eqP (rAV _)). rewrite mxcol_mul diag_mxrow mul_mxdiag_mxcol; apply: eq_mxcol => i. by case: DoA => /= k /(simmxPp); rewrite VA => /(_ isT) ->. Qed. diff -Nru ssreflect-1.14.0/mathcomp/algebra/polydiv.v ssreflect-1.15.0/mathcomp/algebra/polydiv.v --- ssreflect-1.14.0/mathcomp/algebra/polydiv.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/algebra/polydiv.v 2022-06-30 08:50:47.000000000 +0000 @@ -170,7 +170,7 @@ - apply/leq_sizeP => j hnj. rewrite coefB -scalerAl coefZ coefXnM ltn_subRL ltnNge. have hj : (size r).-1 <= j by apply: leq_trans hnj; rewrite -ltnS prednK. - rewrite [r in r <= _]polySpred -?size_poly_gt0 // coefMC. + rewrite [leqLHS]polySpred -?size_poly_gt0 // coefMC. rewrite (leq_ltn_trans hj) /=; last by rewrite -add1n leq_add2r. move: hj; rewrite leq_eqVlt prednK // => /predU1P [<- | hj]. by rewrite -subn1 subnAC subKn // !subn1 !lead_coefE subrr. @@ -624,13 +624,6 @@ End MonicDivisor. -#[deprecated(since="mathcomp 1.12.0", note="Use rdivpDl instead.")] -Notation rdivp_addl := rdivpDl (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use rdivpDr instead.")] -Notation rdivp_addr := rdivpDr (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use rmodpD instead.")] -Notation rmodp_add := rmodpD (only parsing). - End RingMonic. Module Ring. @@ -911,7 +904,7 @@ End WeakTheoryForIDomainPseudoDivision. -Hint Resolve lc_expn_scalp_neq0 : core. +#[global] Hint Resolve lc_expn_scalp_neq0 : core. End WeakIdomain. @@ -1669,7 +1662,7 @@ have [-> | nn0] := eqVneq n 0; first by rewrite gcd0p mulr0 eqpxx. have [-> | mn0] := eqVneq m 0; first by rewrite mul0r gcdp0 eqpxx. rewrite gcdpE modp_mull gcd0p size_mul //; case: leqP; last by rewrite eqpxx. -rewrite (polySpred mn0) addSn /= -[n in _ <= n]add0n leq_add2r -ltnS. +rewrite (polySpred mn0) addSn /= -[leqRHS]add0n leq_add2r -ltnS. rewrite -polySpred //= leq_eqVlt ltnS size_poly_leq0 (negPf mn0) orbF. case/size_poly1P=> c cn0 -> {mn0 m}; rewrite mul_polyC. suff -> : n %% (c *: n) = 0 by rewrite gcd0p; apply: eqp_scale. @@ -2354,23 +2347,8 @@ End IDomainPseudoDivision. -Hint Resolve eqpxx divp0 divp1 mod0p modp0 modp1 dvdp_mull dvdp_mulr dvdpp : core. -Hint Resolve dvdp0 : core. - -#[deprecated(since="mathcomp 1.12.0", note="Use dvdpZl instead.")] -Notation dvdp_scalel := dvdpZl (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use dvdpZr instead.")] -Notation dvdp_scaler := dvdpZr (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use dvdpNr instead.")] -Notation dvdp_opp := dvdpNr (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use coprimepZl instead.")] -Notation coprimep_scalel := coprimepZl (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use coprimepZr instead.")] -Notation coprimep_scaler := coprimepZr (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use coprimepMl instead.")] -Notation coprimep_mull := coprimepMl (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use coprimepMr instead.")] -Notation coprimep_mulr := coprimepMr (only parsing). +#[global] Hint Resolve eqpxx divp0 divp1 mod0p modp0 modp1 : core. +#[global] Hint Resolve dvdp_mull dvdp_mulr dvdpp dvdp0 : core. End CommonIdomain. @@ -2696,23 +2674,6 @@ End MoreUnitDivisor. -#[deprecated(since="mathcomp 1.12.0", note="Use modpZl instead.")] -Notation modp_scalel := modpZl (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use modpZr instead.")] -Notation modp_scaler := modpZr (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use modpN instead.")] -Notation modp_opp := modpN (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use modpD instead.")] -Notation modp_add := modpD (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use divpZl instead.")] -Notation divp_scalel := divpZl (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use divpZr instead.")] -Notation divp_scaler := divpZr (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use divpN instead.")] -Notation divp_opp := divpN (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use divpD instead.")] -Notation divp_add := divpD (only parsing). - End IdomainUnit. Module Field. @@ -3050,10 +3011,10 @@ size p <= 4 -> 1 < size q < size p -> q %| p -> {r | root p r}. Proof. move=> p_le4 /andP[]; rewrite leq_eqVlt eq_sym. -have [/poly2_root[x qx0] _ _ | _ /= q_gt2 p_gt_q] := size q =P 2. +have [/poly2_root[x qx0] _ _ | _ /= q_gt2 p_gt_q] := size q =P 2%N. by exists x; rewrite -!dvdp_XsubCl in qx0 *; apply: (dvdp_trans qx0). case/dvdpP/sig_eqW=> r def_p; rewrite def_p. -suffices /poly2_root[x rx0]: size r = 2 by exists x; rewrite rootM rx0. +suffices /poly2_root[x rx0]: size r = 2%N by exists x; rewrite rootM rx0. have /norP[nz_r nz_q]: ~~ [|| r == 0 | q == 0]. by rewrite -mulf_eq0 -def_p -size_poly_gt0 (leq_ltn_trans _ p_gt_q). rewrite def_p size_mul // -subn1 leq_subLR ltn_subRL in p_gt_q p_le4. @@ -3176,23 +3137,6 @@ End FieldDivision. -#[deprecated(since="mathcomp 1.12.0", note="Use modpZl instead.")] -Notation modp_scalel := modpZl (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use modpZr instead.")] -Notation modp_scaler := modpZr (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use modpN instead.")] -Notation modp_opp := modpN (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use modpD instead.")] -Notation modp_add := modpD (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use divpZl instead.")] -Notation divp_scalel := divpZl (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use divpZr instead.")] -Notation divp_scaler := divpZr (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use divpN instead.")] -Notation divp_opp := divpN (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use divpD instead.")] -Notation divp_add := divpD (only parsing). - End Field. Module ClosedField. diff -Nru ssreflect-1.14.0/mathcomp/algebra/poly.v ssreflect-1.15.0/mathcomp/algebra/poly.v --- ssreflect-1.14.0/mathcomp/algebra/poly.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/algebra/poly.v 2022-06-30 08:50:47.000000000 +0000 @@ -151,7 +151,7 @@ Arguments polyseq {R} p%R. Arguments poly_inj {R} [p1%R p2%R] : rename. Arguments coefp {R} i%N / p%R. -Notation "{ 'poly' T }" := (poly_of (Phant T)). +Notation "{ 'poly' T }" := (poly_of (Phant T)) : type_scope. Definition poly_countMixin (R : countRingType) := [countMixin of polynomial R by <:]. @@ -719,7 +719,7 @@ Lemma polyseqX : 'X = [:: 0; 1] :> seq R. Proof. by rewrite unlock !polyseq_cons nil_poly eqxx /= polyseq1. Qed. -Lemma size_polyX : size 'X = 2. Proof. by rewrite polyseqX. Qed. +Lemma size_polyX : size 'X = 2%N. Proof. by rewrite polyseqX. Qed. Lemma polyX_eq0 : ('X == 0) = false. Proof. by rewrite -size_poly_eq0 size_polyX. Qed. @@ -765,7 +765,7 @@ Lemma size_XsubC a : size ('X - a%:P) = 2%N. Proof. by rewrite polyseqXsubC. Qed. -Lemma size_XaddC b : size ('X + b%:P) = 2. +Lemma size_XaddC b : size ('X + b%:P) = 2%N. Proof. by rewrite -[b]opprK rmorphN size_XsubC. Qed. Lemma lead_coefXsubC a : lead_coef ('X - a%:P) = 1. @@ -792,7 +792,7 @@ by rewrite /lead_coef !nth_last polyseqMX. Qed. -Lemma size_XmulC a : a != 0 -> size ('X * a%:P) = 2. +Lemma size_XmulC a : a != 0 -> size ('X * a%:P) = 2%N. Proof. by move=> nz_a; rewrite -commr_polyX size_mulX ?polyC_eq0 ?size_polyC nz_a. Qed. @@ -2381,7 +2381,7 @@ have nz_q: q != 0 by rewrite -size_poly_eq0 -(subnKC nc_q). rewrite mulnC comp_polyE (polySpred nz_p) /= big_ord_recr /= addrC. rewrite size_addl size_scale ?lead_coef_eq0 ?size_exp //=. -rewrite [X in _ < X]polySpred ?expf_neq0 // ltnS size_exp. +rewrite [ltnRHS]polySpred ?expf_neq0 // ltnS size_exp. rewrite (leq_trans (size_sum _ _ _)) //; apply/bigmax_leqP => i _. rewrite (leq_trans (size_scale_leq _ _)) // polySpred ?expf_neq0 //. by rewrite size_exp -(subnKC nc_q) ltn_pmul2l. @@ -2405,13 +2405,13 @@ by rewrite [_ <= 0]leqNgt (leq_ltn_trans _ sq_gt1) ?andbF ?orbF. Qed. -Lemma size_comp_poly2 p q : size q = 2 -> size (p \Po q) = size p. +Lemma size_comp_poly2 p q : size q = 2%N -> size (p \Po q) = size p. Proof. move=> sq2; have [->|pN0] := eqVneq p 0; first by rewrite comp_polyC. by rewrite polySpred ?size_comp_poly ?comp_poly_eq0 ?sq2 // muln1 polySpred. Qed. -Lemma comp_poly2_eq0 p q : size q = 2 -> (p \Po q == 0) = (p == 0). +Lemma comp_poly2_eq0 p q : size q = 2%N -> (p \Po q == 0) = (p == 0). Proof. by rewrite -!size_poly_eq0 => /size_comp_poly2->. Qed. Theorem max_poly_roots p rs : @@ -2551,7 +2551,7 @@ Variable F : fieldType. Implicit Types (p : {poly F}) (rs : seq F). -Lemma poly2_root p : size p = 2 -> {r | root p r}. +Lemma poly2_root p : size p = 2%N -> {r | root p r}. Proof. case: p => [[|p0 [|p1 []]] //= nz_p1]; exists (- p0 / p1). by rewrite /root addr_eq0 /= mul0r add0r mulrC divfK ?opprK. @@ -2774,20 +2774,3 @@ Qed. End ClosedField. - -#[deprecated(since="mathcomp 1.12.0", note="Use polyCD instead.")] -Notation polyC_add := polyCD (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use polyCN instead.")] -Notation polyC_opp := polyCN (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use polyCB instead.")] -Notation polyC_sub := polyCB (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use polyCMn instead.")] -Notation polyC_muln := polyCMn (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use polyCM instead.")] -Notation polyC_mul := polyCM (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use polyCV instead.")] -Notation polyC_inv := polyCV (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use lead_coefN instead.")] -Notation lead_coef_opp := lead_coefN (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use derivnB instead.")] -Notation derivn_sub := derivnB (only parsing). diff -Nru ssreflect-1.14.0/mathcomp/algebra/polyXY.v ssreflect-1.15.0/mathcomp/algebra/polyXY.v --- ssreflect-1.14.0/mathcomp/algebra/polyXY.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/algebra/polyXY.v 2022-06-30 08:50:47.000000000 +0000 @@ -268,7 +268,7 @@ by rewrite mulrC mul_polyC size_scale ?max_size_lead_coefXY ?lead_coef_eq0. rewrite swapXY_map_polyC lead_coefC size_map_polyC. set v1 := lead_coef _; have nz_v1: v1 != 0 by rewrite lead_coef_eq0 swapXY_eq0. -rewrite [in rhs in _ <= rhs]polySpred ?mulf_neq0 // size_mul //. +rewrite [leqRHS]polySpred ?mulf_neq0 // size_mul //. by rewrite (polySpred nz_v1) addnC addnS polySpred // ltnS leq_addr. Qed. diff -Nru ssreflect-1.14.0/mathcomp/algebra/rat.v ssreflect-1.15.0/mathcomp/algebra/rat.v --- ssreflect-1.14.0/mathcomp/algebra/rat.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/algebra/rat.v 2022-06-30 08:50:47.000000000 +0000 @@ -2,13 +2,15 @@ (* Distributed under the terms of CeCILL-B. *) From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice. From mathcomp Require Import fintype bigop order ssralg countalg div ssrnum. -From mathcomp Require Import ssrint. +From mathcomp Require Import ssrint prime. (******************************************************************************) (* This file defines a datatype for rational numbers and equips it with a *) (* structure of archimedean, real field, with int and nat declared as closed *) (* subrings. *) (* rat == the type of rational number, with single constructor Rat *) +(* == as a rat with a decimal constant. *) +(* This notation is in rat_scope (delimited with %Q). *) (* n%:Q == explicit cast from int to rat, ie. the specialization to *) (* rationals of the generic ring morphism n%:~R *) (* numq r == numerator of (r : rat) *) @@ -16,7 +18,7 @@ (* x \is a Qint == x is an element of rat whose denominator is equal to 1 *) (* x \is a Qnat == x is a non-negative element of rat whose denominator *) (* is equal to 1 *) -(* ratr r == generic embedding of (r : rat) into an arbitrary unitring. *) +(* ratr r == generic embedding of (r : rat) into an arbitrary unit ring.*) (* [rat x // y] == smart constructor for rationals, definitionally equal *) (* to x / y for concrete values, intended for printing only *) (* of normal forms. The parsable notation is for debugging. *) @@ -59,7 +61,7 @@ Lemma denq_gt0 x : 0 < denq x. Proof. by rewrite /denq; case: x=> [[a b] /= /andP []]. Qed. -Hint Resolve denq_gt0 : core. +#[global] Hint Resolve denq_gt0 : core. Definition denq_ge0 x := ltW (denq_gt0 x). @@ -67,7 +69,7 @@ Lemma denq_neq0 x : denq x != 0. Proof. by rewrite /denq gt_eqF ?denq_gt0. Qed. -Hint Resolve denq_neq0 : core. +#[global] Hint Resolve denq_neq0 : core. Lemma denq_eq0 x : (denq x == 0) = false. Proof. exact: negPf (denq_neq0 _). Qed. @@ -132,6 +134,82 @@ end. Arguments fracq : simpl never. +(* Define a Number Notation for rat in rat_scope *) +(* Since rat values obtained from fracq contain fracq_subdef, which is not *) +(* an inductive constructor, we need to go through an intermediate *) +(* inductive type. *) +Variant Irat_prf := Ifracq_subproof : (int * int) -> Irat_prf. +Variant Irat := IRat : (int * int) -> Irat_prf -> Irat. + +Definition parse (x : Number.number) : option Irat := + let parse_pos i f := + let nf := Decimal.nb_digits f in + let d := (10 ^ nf)%nat in + let n := (Nat.of_uint i * d + Nat.of_uint f)%nat in + valq (fracq (Posz n, Posz d)) in + let parse i f := + match i with + | Decimal.Pos i => parse_pos i f + | Decimal.Neg i => let (n, d) := parse_pos i f in ((- n)%R, d) + end in + match x with + | Number.Decimal (Decimal.Decimal i f) => + let nd := parse i f in + Some (IRat nd (Ifracq_subproof nd)) + | Number.Decimal (Decimal.DecimalExp _ _ _) => None + | Number.Hexadecimal _ => None + end. + +Definition print (r : Irat) : option Number.number := + let print_pos n d := + if d == 1%nat then Some (Nat.to_uint n, Decimal.Nil) else + let d2d5 := + match prime_decomp d with + | [:: (2, d2); (5, d5)] => Some (d2, d5) + | [:: (2, d2)] => Some (d2, O) + | [:: (5, d5)] => Some (O, d5) + | _ => None + end in + match d2d5 with + | Some (d2, d5) => + let f := (2 ^ (d5 - d2) * 5 ^ (d2 - d5))%nat in + let (i, f) := edivn (n * f) (d * f) in + Some (Nat.to_uint i, Nat.to_uint f) + | None => None + end in + let print_IRat nd := + match nd with + | (Posz n, Posz d) => + match print_pos n d with + | Some (i, f) => Some (Decimal.Pos i, f) + | None => None + end + | (Negz n, Posz d) => + match print_pos n.+1 d with + | Some (i, f) => Some (Decimal.Neg i, f) + | None => None + end + | (_, Negz _) => None + end in + match r with + | IRat nd _ => + match print_IRat nd with + | Some (i, f) => Some (Number.Decimal (Decimal.Decimal i f)) + | None => None + end + end. + +Number Notation rat parse print (via Irat + mapping [Rat => IRat, fracq_subproof => Ifracq_subproof]) + : rat_scope. + +(* Now, the following should parse as rat (and print unchaged) *) +(* Check 12%Q. *) +(* Check 3.14%Q. *) +(* Check (-3.14)%Q. *) +(* Check 0.5%Q. *) +(* Check 0.2%Q. *) + Lemma val_fracq x : val (fracq x) = fracq_subdef x. Proof. by case: x => [[n|n] [[|[|d]]|d]]//=; rewrite !fracq_opt_subdef_id. Qed. @@ -189,8 +267,8 @@ by rewrite gcdn_gt0 !absz_gt0 d_neq0 orbT !muln1 !mulz_sign_abs. Qed. -Definition zeroq := fracq (0, 1). -Definition oneq := fracq (1, 1). +Definition zeroq := 0%Q. +Definition oneq := 1%Q. Fact frac0q x : fracq (0, x) = zeroq. Proof. @@ -228,7 +306,7 @@ Proof. symmetry; rewrite rat_eqE andbC. have [->|] /= := eqVneq (denq _); first by rewrite (inj_eq (mulIf _)). -apply: contraNF => /eqP hxy; rewrite -absz_denq -[X in _ == X]absz_denq. +apply: contraNF => /eqP hxy; rewrite -absz_denq -[eqbRHS]absz_denq. rewrite eqz_nat /= eqn_dvd. rewrite -(@Gauss_dvdr _ `|numq x|) 1?coprime_sym ?coprime_num_den // andbC. rewrite -(@Gauss_dvdr _ `|numq y|) 1?coprime_sym ?coprime_num_den //. @@ -239,7 +317,7 @@ (fracq x == fracq y) = (x.1 * y.2 == y.1 * x.2). Proof. case: fracqP=> //= u fx u_neq0 _; case: fracqP=> //= v fy v_neq0 _; symmetry. -rewrite [X in (_ == X)]mulrC mulrACA [X in (_ == X)]mulrACA. +rewrite [eqbRHS]mulrC mulrACA [eqbRHS]mulrACA. by rewrite [denq _ * _]mulrC (inj_eq (mulfI _)) ?mulf_neq0 // rat_eq. Qed. @@ -247,7 +325,7 @@ Proof. move: x=> [n d] /=; have [->|d0] := eqVneq d 0. by rewrite fracq0 eqxx orbT. -by rewrite orbF fracq_eq ?d0 //= mulr1 mul0r. +by rewrite -[zeroq]valqK orbF fracq_eq ?d0 //= mulr1 mul0r. Qed. Fact fracqMM x n d : x != 0 -> fracq (x * n, x * d) = fracq (n, d). @@ -340,7 +418,7 @@ Fact add0q : left_id zeroq addq. Proof. -move=> x; rewrite -[x]valqK addq_frac ?denq_neq0 // !addq_subdefE /=. +move=> x; rewrite -[x]valqK -[zeroq]valqK addq_frac ?denq_neq0 // !addq_subdefE. by rewrite mul0r add0r mulr1 mul1r -surjective_pairing. Qed. @@ -409,7 +487,7 @@ Fact mul1q : left_id oneq mulq. Proof. -move=> x; rewrite -[x]valqK; rewrite mulq_frac !mulq_subdefE. +move=> x; rewrite -[x]valqK -[oneq]valqK; rewrite mulq_frac !mulq_subdefE. by rewrite !mul1r -surjective_pairing. Qed. @@ -430,8 +508,8 @@ Fact mulVq x : x != 0 -> mulq (invq x) x = 1. Proof. -rewrite -[x]valqK fracq_eq ?denq_neq0 //= mulr1 mul0r=> nx0. -rewrite !(mulq_frac, invq_frac, mulq_subdefE) ?denq_neq0 //. +rewrite -[x]valqK -[0]valqK fracq_eq ?denq_neq0 //= mulr1 mul0r=> nx0. +rewrite !(mulq_frac, invq_frac, mulq_subdefE) ?denq_neq0 // -[1]valqK. by apply/eqP; rewrite fracq_eq ?mulf_neq0 ?denq_neq0 //= mulr1 mul1r mulrC. Qed. @@ -466,13 +544,11 @@ Notation "n %:Q" := ((n : int)%:~R : rat) : ring_scope. -Hint Resolve denq_neq0 denq_gt0 denq_ge0 : core. +#[global] Hint Resolve denq_neq0 denq_gt0 denq_ge0 : core. Definition subq (x y : rat) : rat := (addq x (oppq y)). Definition divq (x y : rat) : rat := (mulq x (invq y)). -Notation "0" := zeroq : rat_scope. -Notation "1" := oneq : rat_scope. Infix "+" := addq : rat_scope. Notation "- x" := (oppq x) : rat_scope. Infix "*" := mulq : rat_scope. @@ -538,10 +614,11 @@ by case: fracqP => [_|k fx k_neq0] /=; constructor. Qed. -#[deprecated(since="mathcomp 1.13.0", note="Use eqr_div instead.")] -Lemma divq_eq (nx dx ny dy : rat) : +Lemma divq_eq_deprecated (nx dx ny dy : rat) : dx != 0 -> dy != 0 -> (nx / dx == ny / dy) = (nx * dy == ny * dx). -Proof. exact: GRing.eqr_div. Qed. +Proof. exact: eqr_div. Qed. +#[deprecated(since="mathcomp 1.13.0", note="Use eqr_div instead.")] +Notation divq_eq := divq_eq_deprecated (only parsing). Variant rat_spec (* (x : rat) *) : rat -> int -> int -> Type := Rat_spec (n : int) (d : nat) & coprime `|n| d.+1 @@ -948,3 +1025,7 @@ (* For debugging purposes we provide the parsable version *) Notation "[ 'rat' x // y ]" := (@Rat (x : int, y : int) (fracq_subproof (x : int, y : int))) : ring_scope. + +(* A specialization of vm_compute rewrite rule for pattern _%:Q *) +Lemma rat_vm_compute n (x : rat) : vm_compute_eq n%:Q x -> n%:Q = x. +Proof. exact. Qed. diff -Nru ssreflect-1.14.0/mathcomp/algebra/ring_quotient.v ssreflect-1.15.0/mathcomp/algebra/ring_quotient.v --- ssreflect-1.14.0/mathcomp/algebra/ring_quotient.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/algebra/ring_quotient.v 2022-06-30 08:50:47.000000000 +0000 @@ -6,7 +6,7 @@ (******************************************************************************) (* This file describes quotients of algebraic structures. *) (* *) -(* It defines a join hierarchy mxing the structures defined in file ssralg *) +(* It defines a join hierarchy mixing the structures defined in file ssralg *) (* (up to unit ring type) and the quotType quotient structure defined in *) (* file generic_quotient. Every structure in that (join) hierarchy is *) (* parametrized by a base type T and the constants and operations on the *) @@ -85,15 +85,16 @@ Local Open Scope ring_scope. Local Open Scope quotient_scope. -Reserved Notation "{ideal_quot I }" (at level 0, format "{ideal_quot I }"). -Reserved Notation "m = n %[mod_ideal I ]" (at level 70, n at next level, - format "'[hv ' m '/' = n '/' %[mod_ideal I ] ']'"). -Reserved Notation "m == n %[mod_ideal I ]" (at level 70, n at next level, - format "'[hv ' m '/' == n '/' %[mod_ideal I ] ']'"). -Reserved Notation "m <> n %[mod_ideal I ]" (at level 70, n at next level, - format "'[hv ' m '/' <> n '/' %[mod_ideal I ] ']'"). -Reserved Notation "m != n %[mod_ideal I ]" (at level 70, n at next level, - format "'[hv ' m '/' != n '/' %[mod_ideal I ] ']'"). +Reserved Notation "{ 'ideal_quot' I }" + (at level 0, format "{ 'ideal_quot' I }"). +Reserved Notation "m = n %[ 'mod_ideal' I ]" (at level 70, n at next level, + format "'[hv ' m '/' = n '/' %[ 'mod_ideal' I ] ']'"). +Reserved Notation "m == n %[ 'mod_ideal' I ]" (at level 70, n at next level, + format "'[hv ' m '/' == n '/' %[ 'mod_ideal' I ] ']'"). +Reserved Notation "m <> n %[ 'mod_ideal' I ]" (at level 70, n at next level, + format "'[hv ' m '/' <> n '/' %[ 'mod_ideal' I ] ']'"). +Reserved Notation "m != n %[ 'mod_ideal' I ]" (at level 70, n at next level, + format "'[hv ' m '/' != n '/' %[ 'mod_ideal' I ] ']'"). Section ZmodQuot. @@ -121,8 +122,7 @@ Structure zmodQuotType : Type := ZmodQuotTypePack { zmod_quot_sort :> Type; - _ : zmod_quot_class_of zmod_quot_sort; - + _ : zmod_quot_class_of zmod_quot_sort }. Implicit Type zqT : zmodQuotType. @@ -225,8 +225,7 @@ Structure ringQuotType : Type := RingQuotTypePack { ring_quot_sort :> Type; - _ : ring_quot_class_of ring_quot_sort; - + _ : ring_quot_class_of ring_quot_sort }. Implicit Type rqT : ringQuotType. @@ -337,8 +336,7 @@ Structure unitRingQuotType : Type := UnitRingQuotTypePack { unit_ring_quot_sort :> Type; - _ : unit_ring_quot_class_of unit_ring_quot_sort; - + _ : unit_ring_quot_class_of unit_ring_quot_sort }. Implicit Type rqT : unitRingQuotType. @@ -562,7 +560,7 @@ End ZmodQuotient. -Notation "{quot I }" := (@type_of _ _ _ I (Phant _)). +Notation "{ 'quot' I }" := (@type_of _ _ _ I (Phant _)) : type_scope. Section RingQuotient. @@ -629,14 +627,15 @@ End Quotient. -Notation "{ideal_quot I }" := (@Quotient.type_of _ _ _ I (Phant _)). -Notation "x == y %[mod_ideal I ]" := +Notation "{ 'ideal_quot' I }" := + (@Quotient.type_of _ _ _ I (Phant _)) : type_scope. +Notation "x == y %[ 'mod_ideal' I ]" := (x == y %[mod {ideal_quot I}]) : quotient_scope. -Notation "x = y %[mod_ideal I ]" := +Notation "x = y %[ 'mod_ideal' I ]" := (x = y %[mod {ideal_quot I}]) : quotient_scope. -Notation "x != y %[mod_ideal I ]" := +Notation "x != y %[ 'mod_ideal' I ]" := (x != y %[mod {ideal_quot I}]) : quotient_scope. -Notation "x <> y %[mod_ideal I ]" := +Notation "x <> y %[ 'mod_ideal' I ]" := (x <> y %[mod {ideal_quot I}]) : quotient_scope. Canonical Quotient.rquot_eqType. diff -Nru ssreflect-1.14.0/mathcomp/algebra/ssralg.v ssreflect-1.15.0/mathcomp/algebra/ssralg.v --- ssreflect-1.14.0/mathcomp/algebra/ssralg.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/algebra/ssralg.v 2022-06-30 08:50:47.000000000 +0000 @@ -81,6 +81,7 @@ (* n%:R == the ring image of an n in nat; this is just *) (* notation for 1 *+ n, so 1%:R is convertible to 1 *) (* and 2%:R to 1 + 1. *) +(* == %:R with a sequence of digits *) (* x * y == the ring product of x and y. *) (* \prod_ e == iterated product for a ring (cf bigop.v). *) (* x ^+ n == x to the nth power with n in nat (non-negative), *) @@ -380,7 +381,7 @@ (* additive f <-> f of type U -> V is additive, i.e., f maps the *) (* Zmodule structure of U to that of V, 0 to 0, *) (* - to - and + to + (equivalently, binary - to -). *) -(* := {morph f : u v / u + v}. *) +(* := {morph f : u v / u - v}. *) (* {additive U -> V} == the interface type for a Structure (keyed on *) (* a function f : U -> V) that encapsulates the *) (* additive property; both U and V must have *) @@ -542,6 +543,8 @@ (* f \- g == the function x |-> f x - g x, canonically *) (* linear when f and g are, and simplifies on *) (* application. *) +(* \- g == the function x |-> - f x, canonically linear *) +(* when f is, and simplifies on application. *) (* k \*: f == the function x |-> k *: f x, which is *) (* canonically linear when f is and simplifies on *) (* application (this is a shorter alternative to *) @@ -555,6 +558,8 @@ (* a \o* f == the function x |-> f x * a, canonically linear *) (* linear when f is and its codomain is an lalgType *) (* and which simplifies on application. *) +(* f \* g == the function x |-> f x * g x; f \* g simplifies *) +(* on application. *) (* The Lemmas about these structures are contained in both the GRing module *) (* and in the submodule GRing.Theory, which can be imported when unqualified *) (* access to the theory is needed (GRing.Theory also allows the unqualified *) @@ -613,9 +618,11 @@ Reserved Notation "\0" (at level 0). Reserved Notation "f \+ g" (at level 50, left associativity). Reserved Notation "f \- g" (at level 50, left associativity). +Reserved Notation "\- f" (at level 35, f at level 35). Reserved Notation "a \*o f" (at level 40). Reserved Notation "a \o* f" (at level 40). Reserved Notation "a \*: f" (at level 40). +Reserved Notation "f \* g" (at level 40, left associativity). Delimit Scope ring_scope with R. Delimit Scope term_scope with T. @@ -871,9 +878,9 @@ Lemma telescope_sumr n m (f : nat -> V) : n <= m -> \sum_(n <= k < m) (f k.+1 - f k) = f m - f n. Proof. -rewrite leq_eqVlt => /predU1P[-> | ]; first by rewrite subrr big_geq. -case: m => // m lenm; rewrite sumrB big_nat_recr // big_nat_recl //=. -by rewrite addrC opprD addrA subrK addrC. +move=> nm; rewrite (telescope_big (fun i j => f j - f i)). + by case: ltngtP nm => // ->; rewrite subrr. +by move=> k /andP[nk km]/=; rewrite addrC subrKA. Qed. Section ClosedPredicates. @@ -1847,7 +1854,7 @@ Coercion apply : map >-> Funclass. Notation Additive fA := (Pack (Phant _) fA). Notation "{ 'additive' fUV }" := (map (Phant fUV)) - (at level 0, format "{ 'additive' fUV }") : ring_scope. + (at level 0, format "{ 'additive' fUV }") : type_scope. Notation "[ 'additive' 'of' f 'as' g ]" := (@clone _ _ _ f g _ _ idfun id) (at level 0, format "[ 'additive' 'of' f 'as' g ]") : form_scope. Notation "[ 'additive' 'of' f ]" := (@clone _ _ _ f f _ _ id id) @@ -1863,6 +1870,7 @@ Definition null_fun_head (phV : phant V) of U : V := let: Phant := phV in 0. Definition add_fun (f g : U -> V) x := f x + g x. Definition sub_fun (f g : U -> V) x := f x - g x. +Definition opp_fun (f : U -> V) x := - f x. End LiftedZmod. (* Lifted multiplication. *) @@ -1871,6 +1879,7 @@ Implicit Type f : T -> R. Definition mull_fun a f x := a * f x. Definition mulr_fun a f x := f x * a. +Definition mul_fun f g x := f x * g x. End LiftedRing. (* Lifted linear operations. *) @@ -1888,15 +1897,19 @@ Local Notation "\0" := (null_fun _) : ring_scope. Local Notation "f \+ g" := (add_fun f g) : ring_scope. Local Notation "f \- g" := (sub_fun f g) : ring_scope. +Local Notation "\- f" := (opp_fun f) : ring_scope. Local Notation "a \*: f" := (scale_fun a f) : ring_scope. Local Notation "x \*o f" := (mull_fun x f) : ring_scope. Local Notation "x \o* f" := (mulr_fun x f) : ring_scope. +Local Notation "f \* g" := (mul_fun f g) : ring_scope. Arguments add_fun {_ _} f g _ /. Arguments sub_fun {_ _} f g _ /. +Arguments opp_fun {_ _} f _ /. Arguments mull_fun {_ _} a f _ /. Arguments mulr_fun {_ _} a f _ /. Arguments scale_fun {_ _ _} a f _ /. +Arguments mul_fun {_ _} f g _ /. Section AdditiveTheory. @@ -1996,6 +2009,10 @@ Qed. Canonical sub_fun_additive := Additive sub_fun_is_additive. +Fact opp_fun_is_additive : additive (\- f). +Proof. by move=> x y /=; rewrite !raddfB opprB addrC opprK. Qed. +Canonical opp_fun_additive := Additive opp_fun_is_additive. + End AddFun. Section MulFun. @@ -2063,7 +2080,7 @@ Notation RMorphism fM := (Pack (Phant _) fM). Notation AddRMorphism fM := (pack fM id). Notation "{ 'rmorphism' fRS }" := (map (Phant fRS)) - (at level 0, format "{ 'rmorphism' fRS }") : ring_scope. + (at level 0, format "{ 'rmorphism' fRS }") : type_scope. Notation "[ 'rmorphism' 'of' f 'as' g ]" := (@clone _ _ _ f g _ _ idfun id) (at level 0, format "[ 'rmorphism' 'of' f 'as' g ]") : form_scope. Notation "[ 'rmorphism' 'of' f ]" := (@clone _ _ _ f f _ _ id id) @@ -2274,11 +2291,11 @@ Notation Linear fL := (Pack (Phant _) fL). Notation AddLinear fZ := (pack fZ id). Notation "{ 'linear' fUV | s }" := (map s (Phant fUV)) - (at level 0, format "{ 'linear' fUV | s }") : ring_scope. + (at level 0, format "{ 'linear' fUV | s }") : type_scope. Notation "{ 'linear' fUV }" := {linear fUV | *:%R} - (at level 0, format "{ 'linear' fUV }") : ring_scope. + (at level 0, format "{ 'linear' fUV }") : type_scope. Notation "{ 'scalar' U }" := {linear U -> _ | *%R} - (at level 0, format "{ 'scalar' U }") : ring_scope. + (at level 0, format "{ 'scalar' U }") : type_scope. Notation "[ 'linear' 'of' f 'as' g ]" := (@clone _ _ _ _ _ f g _ _ idfun id) (at level 0, format "[ 'linear' 'of' f 'as' g ]") : form_scope. Notation "[ 'linear' 'of' f ]" := (@clone _ _ _ _ _ f f _ _ id id) @@ -2420,6 +2437,10 @@ Proof. by move=> a u; rewrite /= !linearZ_LR !Ds raddfB. Qed. Canonical sub_fun_linear := AddLinear sub_fun_is_scalable. +Lemma opp_fun_is_scalable : scalable_for s (\- f). +Proof. by move=> a u; rewrite /= linearZ_LR Ds raddfN. Qed. +Canonical opp_fun_linear := AddLinear opp_fun_is_scalable. + End LinearLmod. Section LinearLalg. @@ -2481,9 +2502,9 @@ Notation LRMorphism f_lrM := (Pack (Phant _) (Class f_lrM f_lrM)). Notation AddLRMorphism fZ := (pack fZ id). Notation "{ 'lrmorphism' fAB | s }" := (map s (Phant fAB)) - (at level 0, format "{ 'lrmorphism' fAB | s }") : ring_scope. + (at level 0, format "{ 'lrmorphism' fAB | s }") : type_scope. Notation "{ 'lrmorphism' fAB }" := {lrmorphism fAB | *:%R} - (at level 0, format "{ 'lrmorphism' fAB }") : ring_scope. + (at level 0, format "{ 'lrmorphism' fAB }") : type_scope. Notation "[ 'lrmorphism' 'of' f ]" := (@clone _ _ _ _ _ f _ _ id _ _ id) (at level 0, format "[ 'lrmorphism' 'of' f ]") : form_scope. Coercion additive : map >-> Additive.map. @@ -2997,12 +3018,8 @@ (forall k, n < k < m -> f k \is a unit) -> n < m -> \prod_(n <= k < m) (f k / f k.+1) = f n / f m. Proof. -move=> Uf /subnK-Dm; do [rewrite -{}Dm; move: {m}(m - _)%N => m] in Uf *. -rewrite unlock /index_iota -addSnnS addnK /= -mulrA; congr (_ * _). -have{Uf}: all [preim f of unit] (iota n.+1 m). - by apply/allP=> k; rewrite mem_iota addnC => /Uf. -elim: m n => [|m IHm] n /=; first by rewrite mulr1. -by rewrite -mulrA addSnnS => /andP[/mulKr-> /IHm]. +move=> Uf ltnm; rewrite (telescope_big (fun i j => f i / f j)) ?ltnm//. +by move=> k ltnkm /=; rewrite mulrA divrK// Uf. Qed. Lemma commrV x y : comm x y -> comm x y^-1. @@ -5936,6 +5953,7 @@ Definition telescope_prodf := telescope_prodf. Definition addf_div := addf_div. Definition mulf_div := mulf_div. +Definition eqr_div := eqr_div. Definition char0_natf_div := char0_natf_div. Definition fpredMr := fpredMr. Definition fpredMl := fpredMl. @@ -6084,6 +6102,26 @@ Export Pred.Exports SubType.Exports. Notation QEdecFieldMixin := QEdecFieldMixin. +Variant Ione := IOne : Ione. +Variant Inatmul := INatmul : Ione -> nat -> Inatmul. +Variant Idummy_placeholder :=. + +Definition parse (x : Number.uint) : Inatmul := + INatmul IOne (Nat.of_num_uint x). + +Definition print (x : Inatmul) : Number.uint := + match x with + | INatmul IOne n => Number.UIntDecimal (Nat.to_uint n) + end. + +Arguments GRing.one {R}. +Set Warnings "-via-type-remapping,-via-type-mismatch". +Number Notation Idummy_placeholder parse print (via Inatmul + mapping [[GRing.natmul] => INatmul, [GRing.one] => IOne]) + : ring_scope. +Set Warnings "via-type-remapping,via-type-mismatch". +Arguments GRing.one : clear implicits. + Notation "0" := (zero _) : ring_scope. Notation "-%R" := (@opp _) : fun_scope. Notation "- x" := (opp x) : ring_scope. @@ -6114,15 +6152,19 @@ Notation "\0" := (null_fun _) : ring_scope. Notation "f \+ g" := (add_fun f g) : ring_scope. Notation "f \- g" := (sub_fun f g) : ring_scope. +Notation "\- f" := (opp_fun f) : ring_scope. Notation "a \*: f" := (scale_fun a f) : ring_scope. Notation "x \*o f" := (mull_fun x f) : ring_scope. Notation "x \o* f" := (mulr_fun x f) : ring_scope. +Notation "f \* g" := (mul_fun f g) : ring_scope. Arguments add_fun {_ _} f g _ /. Arguments sub_fun {_ _} f g _ /. +Arguments opp_fun {_ _} f _ /. Arguments mull_fun {_ _} a f _ /. Arguments mulr_fun {_ _} a f _ /. Arguments scale_fun {_ _ _} a f _ /. +Arguments mul_fun {_ _} f g _ /. Notation "\sum_ ( i <- r | P ) F" := (\big[+%R/0%R]_(i <- r | P%B) F%R) : ring_scope. @@ -6205,6 +6247,8 @@ Canonical add_fun_linear. Canonical sub_fun_additive. Canonical sub_fun_linear. +Canonical opp_fun_additive. +Canonical opp_fun_linear. Canonical mull_fun_additive. Canonical mull_fun_linear. Canonical mulr_fun_additive. diff -Nru ssreflect-1.14.0/mathcomp/algebra/ssrint.v ssreflect-1.15.0/mathcomp/algebra/ssrint.v --- ssreflect-1.14.0/mathcomp/algebra/ssrint.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/algebra/ssrint.v 2022-06-30 08:50:47.000000000 +0000 @@ -13,10 +13,16 @@ (* However (Posz m = Posz n) is displayed as (m = n :> int) *) (* (and so are ==, != and <>) *) (* Lemma NegzE : turns (Negz n) into - n.+1%:Z. *) +(* == as an int with an optional minus sign *) +(* followed by a sequence of digits. This notation is in *) +(* int_scope (delimited with %Z). *) (* x *~ m == m times x, with m : int; *) (* convertible to x *+ n if m is Posz n *) (* convertible to x *- n.+1 if m is Negz n. *) (* m%:~R == the image of m : int in a generic ring (:= 1 *~ m). *) +(* == %:~R with an optional minus sign followed *) +(* by a sequence of digits. This notation is in ring_scope *) +(* (delimited with %R). *) (* x ^ m == x to the m, with m : int; *) (* convertible to x ^+ n if m is Posz n *) (* convertible to x ^- n.+1 if m is Negz n. *) @@ -72,6 +78,22 @@ Notation "n != m :> 'int'" := (Posz n != Posz m) (only printing) : ring_scope. Notation "n <> m :> 'int'" := (Posz n <> Posz m) (only printing) : ring_scope. +Definition parse_int (x : Number.int) : int := + match x with + | Number.IntDecimal (Decimal.Pos u) => Posz (Nat.of_uint u) + | Number.IntDecimal (Decimal.Neg u) => Negz (Nat.of_uint u).-1 + | Number.IntHexadecimal (Hexadecimal.Pos u) => Posz (Nat.of_hex_uint u) + | Number.IntHexadecimal (Hexadecimal.Neg u) => Negz (Nat.of_hex_uint u).-1 + end. + +Definition print_int (x : int) : Number.int := + match x with + | Posz n => Number.IntDecimal (Decimal.Pos (Nat.to_uint n)) + | Negz n => Number.IntDecimal (Decimal.Neg (Nat.to_uint n.+1)) + end. + +Number Notation int parse_int print_int : int_scope. + Definition natsum_of_int (m : int) : nat + nat := match m with Posz p => inl _ p | Negz n => inr _ n end. @@ -107,7 +129,6 @@ | Negz n => Posz (n.+1)%N end. -Local Notation "0" := (Posz 0) : int_scope. Local Notation "-%Z" := (@oppz) : int_scope. Local Notation "- x" := (oppz x) : int_scope. Local Notation "+%Z" := (@addz) : int_scope. @@ -256,7 +277,6 @@ | Negz n', Posz m' => - (m' * (n'.+1%N))%N%:Z end. -Local Notation "1" := (1%N:int) : int_scope. Local Notation "*%Z" := (@mulz) : int_scope. Local Notation "x * y" := (mulz x y) : int_scope. @@ -517,6 +537,32 @@ Lemma nmulrn (R : zmodType) (x : R) (n : nat) : x *- n = x *~ - n%:Z. Proof. by case: n=> [] //; rewrite ?oppr0. Qed. +Variant Iintmul := IIntmul : Ione -> int -> Iintmul. + +Definition parse (x : Number.int) : Iintmul := + let i := + match x with + | Number.IntDecimal (Decimal.Pos u) => Posz (Nat.of_uint u) + | Number.IntDecimal (Decimal.Neg u) => Negz (Nat.of_uint u).-1 + | Number.IntHexadecimal (Hexadecimal.Pos u) => Posz (Nat.of_hex_uint u) + | Number.IntHexadecimal (Hexadecimal.Neg u) => Negz (Nat.of_hex_uint u).-1 + end in + IIntmul IOne i. + +Definition print (x : Iintmul) : Number.int := + match x with + | IIntmul IOne (Posz n) => Number.IntDecimal (Decimal.Pos (Nat.to_uint n)) + | IIntmul IOne (Negz n) => Number.IntDecimal (Decimal.Neg (Nat.to_uint n.+1)) + end. + +Arguments GRing.one {R}. +Set Warnings "-via-type-remapping,-via-type-mismatch". +Number Notation Idummy_placeholder parse print (via Iintmul + mapping [[intmul] => IIntmul, [GRing.one] => IOne]) + : ring_scope. +Set Warnings "via-type-remapping,via-type-mismatch". +Arguments GRing.one : clear implicits. + Section ZintLmod. Definition zmodule (M : Type) : Type := M. @@ -1789,6 +1835,3 @@ Proof. by rewrite -signr_odd; case: (odd n); rewrite ?rpredV. Qed. End rpred. - -#[deprecated(since="mathcomp 1.12.0", note="Use polyCMz instead.")] -Notation polyC_mulrz := polyCMz (only parsing). diff -Nru ssreflect-1.14.0/mathcomp/algebra/ssrnum.v ssreflect-1.15.0/mathcomp/algebra/ssrnum.v --- ssreflect-1.14.0/mathcomp/algebra/ssrnum.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/algebra/ssrnum.v 2022-06-30 08:50:47.000000000 +0000 @@ -125,6 +125,11 @@ Unset Strict Implicit. Unset Printing Implicit Defensive. +Reserved Notation "n .-root" (at level 2, format "n .-root"). +Reserved Notation "'i" (at level 0). +Reserved Notation "'Re z" (at level 10, z at level 8). +Reserved Notation "'Im z" (at level 10, z at level 8). + Local Open Scope order_scope. Local Open Scope ring_scope. Import Order.TTheory GRing.Theory. @@ -1485,7 +1490,7 @@ Lemma normr_id v : `| `|v| | = `|v|. Proof. -have nz2: 2%:R != 0 :> R by rewrite pnatr_eq0. +have nz2: 2 != 0 :> R by rewrite pnatr_eq0. apply: (mulfI nz2); rewrite -{1}normr_nat -normrM mulr_natl mulr2n ger0_norm //. by rewrite -{2}normrN -normr0 -(subrr v) ler_norm_add. Qed. @@ -1561,12 +1566,12 @@ Arguments ltr01 {R}. Arguments normr_idP {R x}. Arguments normr0P {R V v}. -Hint Resolve ler01 ltr01 ltr0Sn ler0n : core. -Hint Extern 0 (is_true (0 <= norm _)) => apply: normr_ge0 : core. +#[global] Hint Resolve ler01 ltr01 ltr0Sn ler0n : core. +#[global] Hint Extern 0 (is_true (0 <= norm _)) => apply: normr_ge0 : core. Lemma normr_nneg (R : numDomainType) (x : R) : `|x| \is Num.nneg. Proof. by rewrite qualifE. Qed. -Hint Resolve normr_nneg : core. +#[global] Hint Resolve normr_nneg : core. Section NumDomainOperationTheory. @@ -1613,6 +1618,9 @@ Lemma oppr_lt0 x : (- x < 0) = (0 < x). Proof. by rewrite lter_oppl oppr0. Qed. +Lemma gtr_opp x : 0 < x -> - x < x. +Proof. by move=> n0; rewrite -subr_lt0 -opprD oppr_lt0 addr_gt0. Qed. + Definition oppr_lte0 := (oppr_le0, oppr_lt0). Definition oppr_cp0 := (oppr_gte0, oppr_lte0). Definition lter_oppE := (oppr_cp0, lter_opp2). @@ -2335,6 +2343,15 @@ Lemma mulr_gt0 x y : 0 < x -> 0 < y -> 0 < x * y. Proof. by move=> x_gt0 y_gt0; rewrite pmulr_rgt0. Qed. +(* and reverse direction *) + +Lemma mulr_ge0_gt0 x y : 0 <= x -> 0 <= y -> (0 < x * y) = (0 < x) && (0 < y). +Proof. +rewrite le_eqVlt => /predU1P[<-|x0]; first by rewrite mul0r ltxx. +rewrite le_eqVlt => /predU1P[<-|y0]; first by rewrite mulr0 ltxx andbC. +by apply/idP/andP=> [|_]; rewrite pmulr_rgt0. +Qed. + (* Iterated products *) Lemma prodr_ge0 I r (P : pred I) (E : I -> R) : @@ -3502,7 +3519,7 @@ End NumDomainOperationTheory. -Hint Resolve ler_opp2 ltr_opp2 real0 real1 normr_real : core. +#[global] Hint Resolve ler_opp2 ltr_opp2 real0 real1 normr_real : core. Arguments ler_sqr {R} [x y]. Arguments ltr_sqr {R} [x y]. Arguments signr_inj {R} [x1 x2]. @@ -3730,6 +3747,9 @@ Lemma sgrV x : sgr x^-1 = sgr x. Proof. by rewrite /sgr invr_eq0 invr_lt0. Qed. +Lemma splitr x : x = x / 2%:R + x / 2%:R. +Proof. by rewrite -mulr2n -mulr_natr mulfVK //= pnatr_eq0. Qed. + (* lteif *) Lemma lteif_pdivl_mulr C z x y : @@ -3766,7 +3786,7 @@ (* Interval midpoint. *) -Local Notation mid x y := ((x + y) / 2%:R). +Local Notation mid x y := ((x + y) / 2). Lemma midf_le x y : x <= y -> (x <= mid x y) * (mid x y <= y). Proof. @@ -3782,6 +3802,34 @@ Definition midf_lte := (midf_le, midf_lt). +Lemma ler_addgt0Pr x y : reflect (forall e, e > 0 -> x <= y + e) (x <= y). +Proof. +apply/(iffP idP)=> [lexy e e_gt0 | lexye]; first by rewrite ler_paddr// ltW. +have [||ltyx]// := comparable_leP. + rewrite (@comparabler_trans _ (y + 1))// /Order.comparable ?lexye ?ltr01//. + by rewrite ler_addl ler01 orbT. +have /midf_lt [_] := ltyx; rewrite le_gtF//. +rewrite -(@addrK _ y y) addrAC -addrA 2!mulrDl -splitr lexye//. +by rewrite divr_gt0// ?ltr0n// subr_gt0. +Qed. + +Lemma ler_addgt0Pl x y : reflect (forall e, e > 0 -> x <= e + y) (x <= y). +Proof. +by apply/(equivP (ler_addgt0Pr x y)); split=> lexy e /lexy; rewrite addrC. +Qed. + +Lemma lt_le a b : (forall x, x < a -> x < b) -> a <= b. +Proof. +move=> ab; apply/ler_addgt0Pr => e e_gt0; rewrite -ler_subl_addr ltW//. +by rewrite ab // ltr_subl_addr -ltr_subl_addl subrr. +Qed. + +Lemma gt_ge a b : (forall x, b < x -> a < x) -> a <= b. +Proof. +move=> ab; apply/ler_addgt0Pr => e e_gt0. +by rewrite ltW// ab// -ltr_subl_addl subrr. +Qed. + (* The AGM, unscaled but without the nth root. *) Lemma real_leif_mean_square x y : @@ -3917,37 +3965,29 @@ End RealDomainTheory. -Hint Resolve num_real : core. +#[global] Hint Resolve num_real : core. Section RealDomainOperations. Notation "[ 'arg' 'min_' ( i < i0 | P ) F ]" := - (Order.arg_min (disp := ring_display) i0 (fun i => P%B) (fun i => F)) - (at level 0, i, i0 at level 10, - format "[ 'arg' 'min_' ( i < i0 | P ) F ]") : ring_scope. + (Order.arg_min (disp := ring_display) i0 (fun i => P%B) (fun i => F)) : + ring_scope. Notation "[ 'arg' 'min_' ( i < i0 'in' A ) F ]" := - [arg min_(i < i0 | i \in A) F] - (at level 0, i, i0 at level 10, - format "[ 'arg' 'min_' ( i < i0 'in' A ) F ]") : ring_scope. - -Notation "[ 'arg' 'min_' ( i < i0 ) F ]" := [arg min_(i < i0 | true) F] - (at level 0, i, i0 at level 10, - format "[ 'arg' 'min_' ( i < i0 ) F ]") : ring_scope. + [arg min_(i < i0 | i \in A) F] : ring_scope. + +Notation "[ 'arg' 'min_' ( i < i0 ) F ]" := [arg min_(i < i0 | true) F] : + ring_scope. Notation "[ 'arg' 'max_' ( i > i0 | P ) F ]" := - (Order.arg_max (disp := ring_display) i0 (fun i => P%B) (fun i => F)) - (at level 0, i, i0 at level 10, - format "[ 'arg' 'max_' ( i > i0 | P ) F ]") : ring_scope. + (Order.arg_max (disp := ring_display) i0 (fun i => P%B) (fun i => F)) : + ring_scope. Notation "[ 'arg' 'max_' ( i > i0 'in' A ) F ]" := - [arg max_(i > i0 | i \in A) F] - (at level 0, i, i0 at level 10, - format "[ 'arg' 'max_' ( i > i0 'in' A ) F ]") : ring_scope. - -Notation "[ 'arg' 'max_' ( i > i0 ) F ]" := [arg max_(i > i0 | true) F] - (at level 0, i, i0 at level 10, - format "[ 'arg' 'max_' ( i > i0 ) F ]") : ring_scope. + [arg max_(i > i0 | i \in A) F] : ring_scope. + +Notation "[ 'arg' 'max_' ( i > i0 ) F ]" := [arg max_(i > i0 | true) F] : + ring_scope. (* sgr section *) @@ -4225,10 +4265,10 @@ Variables (F : realFieldType) (x y : F). -Lemma leif_mean_square : x * y <= (x ^+ 2 + y ^+ 2) / 2%:R ?= iff (x == y). +Lemma leif_mean_square : x * y <= (x ^+ 2 + y ^+ 2) / 2 ?= iff (x == y). Proof. by apply: real_leif_mean_square; apply: num_real. Qed. -Lemma leif_AGM2 : x * y <= ((x + y) / 2%:R)^+ 2 ?= iff (x == y). +Lemma leif_AGM2 : x * y <= ((x + y) / 2)^+ 2 ?= iff (x == y). Proof. by apply: real_leif_AGM2; apply: num_real. Qed. End RealField. @@ -4240,7 +4280,7 @@ Lemma archi_boundP : 0 <= x -> x < (bound x)%:R. Proof. by move/ger0_norm=> {1}<-; rewrite /bound; case: (sigW _). Qed. -Lemma upper_nthrootP i : (bound x <= i)%N -> x < 2%:R ^+ i. +Lemma upper_nthrootP i : (bound x <= i)%N -> x < 2 ^+ i. Proof. rewrite /bound; case: (sigW _) => /= b le_x_b le_b_i. apply: le_lt_trans (ler_norm x) (lt_trans le_x_b _ ). @@ -4379,8 +4419,9 @@ Definition normCK x : `|x| ^+ 2 = x * x^*. Proof. by case: C x => ? [? ? ? []]. Qed. -Lemma sqrCi : 'i ^+ 2 = -1 :> C. -Proof. by case: C => ? [? ? ? []]. Qed. +Lemma sqrCi : 'i ^+ 2 = -1 :> C. Proof. by case: C => ? [? ? ? []]. Qed. + +Lemma mulCii : 'i * 'i = -1 :> C. Proof. exact: sqrCi. Qed. Lemma conjCK : involutive (@conjC C). Proof. @@ -4389,7 +4430,7 @@ by apply: (canRL (mulfK _)) => //; rewrite mulrC -normCK. move=> x; have [->|x_neq0] := eqVneq x 0; first by rewrite !rmorph0. rewrite !JE normrM normfV exprMn normrX normr_id. -rewrite invfM exprVn (AC (2*2)%AC (1*(2*3)*4)%AC)/= -invfM -exprMn. +rewrite invfM exprVn (AC (2*2) (1*(2*3)*4))/= -invfM -exprMn. by rewrite divff ?mul1r ?invrK // !expf_eq0 normr_eq0 //. Qed. @@ -4432,16 +4473,21 @@ Qed. Definition nthroot n x := let: RootCspec y _ _ := rootC_subproof n x in y. -Notation "n .-root" := (nthroot n) (at level 2, format "n .-root") : ring_scope. -Notation "n .-root" := (nthroot n) (only parsing) : ring_scope. +Notation "n .-root" := (nthroot n) : ring_scope. Notation sqrtC := 2.-root. -Definition Re x := (x + x^*) / 2%:R. -Definition Im x := 'i * (x^* - x) / 2%:R. -Notation "'Re z" := (Re z) (at level 10, z at level 8) : ring_scope. -Notation "'Im z" := (Im z) (at level 10, z at level 8) : ring_scope. +Fact Re_lock : unit. Proof. exact: tt. Qed. +Fact Im_lock : unit. Proof. exact: tt. Qed. +Definition Re z := locked_with Re_lock ((z + z^*) / 2%:R). +Definition Im z := locked_with Im_lock ('i * (z^* - z) / 2%:R). +Notation "'Re z" := (Re z) : ring_scope. +Notation "'Im z" := (Im z) : ring_scope. + +Lemma ReE z : 'Re z = (z + z^*) / 2%:R. Proof. by rewrite ['Re _]unlock. Qed. +Lemma ImE z : 'Im z = 'i * (z^* - z) / 2%:R. +Proof. by rewrite ['Im _]unlock. Qed. -Let nz2 : 2%:R != 0 :> C. Proof. by rewrite pnatr_eq0. Qed. +Let nz2 : 2 != 0 :> C. Proof. by rewrite pnatr_eq0. Qed. Lemma normCKC x : `|x| ^+ 2 = x^* * x. Proof. by rewrite normCK mulrC. Qed. @@ -4468,6 +4514,7 @@ Lemma conjC_nat n : (n%:R)^* = n%:R :> C. Proof. exact: rmorph_nat. Qed. Lemma conjC0 : 0^* = 0 :> C. Proof. exact: rmorph0. Qed. Lemma conjC1 : 1^* = 1 :> C. Proof. exact: rmorph1. Qed. +Lemma conjCN1 : (- 1)^* = - 1 :> C. Proof. exact: rmorphN1. Qed. Lemma conjC_eq0 x : (x^* == 0) = (x == 0). Proof. exact: fmorph_eq0. Qed. Lemma invC_norm x : x^-1 = `|x| ^- 2 * x^*. @@ -4493,6 +4540,9 @@ Lemma conj_normC z : `|z|^* = `|z|. Proof. by rewrite conj_Creal ?normr_real. Qed. +Lemma CrealJ : {mono (@conjC C) : x / x \is Num.real}. +Proof. by apply: (homo_mono1 conjCK) => x xreal; rewrite conj_Creal. Qed. + Lemma geC0_conj x : 0 <= x -> x^* = x. Proof. by move=> /ger0_real/CrealP. Qed. @@ -4544,33 +4594,39 @@ Lemma Crect x : x = 'Re x + 'i * 'Im x. Proof. -rewrite 2!mulrA -expr2 sqrCi mulN1r opprB -mulrDl addrACA subrr addr0. -by rewrite -mulr2n -mulr_natr mulfK. +rewrite !(ReE, ImE) 2!mulrA mulCii mulN1r opprB -mulrDl. +by rewrite addrACA subrr addr0 -mulr2n -mulr_natr mulfK. Qed. +Lemma eqCP x y : x = y <-> ('Re x = 'Re y) /\ ('Im x = 'Im y). +Proof. by split=> [->//|[eqRe eqIm]]; rewrite [x]Crect [y]Crect eqRe eqIm. Qed. + +Lemma eqC x y : (x == y) = ('Re x == 'Re y) && ('Im x == 'Im y). +Proof. by apply/eqP/(andPP eqP eqP) => /eqCP. Qed. + Lemma Creal_Re x : 'Re x \is real. -Proof. by rewrite CrealE fmorph_div rmorph_nat rmorphD conjCK addrC. Qed. +Proof. by rewrite ReE CrealE fmorph_div rmorph_nat rmorphD conjCK addrC. Qed. Lemma Creal_Im x : 'Im x \is real. Proof. -rewrite CrealE fmorph_div rmorph_nat rmorphM rmorphB conjCK. +rewrite ImE CrealE fmorph_div rmorph_nat rmorphM rmorphB conjCK. by rewrite conjCi -opprB mulrNN. Qed. Hint Resolve Creal_Re Creal_Im : core. Fact Re_is_additive : additive Re. -Proof. by move=> x y; rewrite /Re rmorphB addrACA -opprD mulrBl. Qed. +Proof. by move=> x y; rewrite !ReE rmorphB addrACA -opprD mulrBl. Qed. Canonical Re_additive := Additive Re_is_additive. Fact Im_is_additive : additive Im. Proof. -by move=> x y; rewrite /Im rmorphB opprD addrACA -opprD mulrBr mulrBl. +by move=> x y; rewrite !ImE rmorphB opprD addrACA -opprD mulrBr mulrBl. Qed. Canonical Im_additive := Additive Im_is_additive. Lemma Creal_ImP z : reflect ('Im z = 0) (z \is real). Proof. -rewrite CrealE -subr_eq0 -(can_eq (mulKf neq0Ci)) mulr0. +rewrite ImE CrealE -subr_eq0 -(can_eq (mulKf neq0Ci)) mulr0. by rewrite -(can_eq (divfK nz2)) mul0r; apply: eqP. Qed. @@ -4582,7 +4638,7 @@ Lemma ReMl : {in real, forall x, {morph Re : z / x * z}}. Proof. -by move=> x Rx z /=; rewrite /Re rmorphM (conj_Creal Rx) -mulrDr -mulrA. +by move=> x Rx z /=; rewrite !ReE rmorphM (conj_Creal Rx) -mulrDr -mulrA. Qed. Lemma ReMr : {in real, forall x, {morph Re : z / z * x}}. @@ -4590,25 +4646,25 @@ Lemma ImMl : {in real, forall x, {morph Im : z / x * z}}. Proof. -by move=> x Rx z; rewrite /Im rmorphM (conj_Creal Rx) -mulrBr mulrCA !mulrA. +by move=> x Rx z; rewrite !ImE rmorphM (conj_Creal Rx) -mulrBr mulrCA !mulrA. Qed. Lemma ImMr : {in real, forall x, {morph Im : z / z * x}}. Proof. by move=> x Rx z /=; rewrite mulrC ImMl // mulrC. Qed. -Lemma Re_i : 'Re 'i = 0. Proof. by rewrite /Re conjCi subrr mul0r. Qed. +Lemma Re_i : 'Re 'i = 0. Proof. by rewrite ReE conjCi subrr mul0r. Qed. Lemma Im_i : 'Im 'i = 1. Proof. -rewrite /Im conjCi -opprD mulrN -mulr2n mulrnAr ['i * _]sqrCi. +rewrite ImE conjCi -opprD mulrN -mulr2n mulrnAr mulCii. by rewrite mulNrn opprK divff. Qed. Lemma Re_conj z : 'Re z^* = 'Re z. -Proof. by rewrite /Re addrC conjCK. Qed. +Proof. by rewrite !ReE addrC conjCK. Qed. Lemma Im_conj z : 'Im z^* = - 'Im z. -Proof. by rewrite /Im -mulNr -mulrN opprB conjCK. Qed. +Proof. by rewrite !ImE -mulNr -mulrN opprB conjCK. Qed. Lemma Re_rect : {in real &, forall x y, 'Re (x + 'i * y) = x}. Proof. @@ -4641,10 +4697,29 @@ Lemma mulC_rect x1 y1 x2 y2 : (x1 + 'i * y1) * (x2 + 'i * y2) = x1 * x2 - y1 * y2 + 'i * (x1 * y2 + x2 * y1). Proof. -rewrite mulrDl !mulrDr (AC (2*2)%AC (1*4*(2*3))%AC)/= mulrACA. +rewrite mulrDl !mulrDr (AC (2*2) (1*4*(2*3)))/= mulrACA. by rewrite -expr2 sqrCi mulN1r -!mulrA [_ * ('i * _)]mulrCA [_ * y1]mulrC. Qed. +Lemma ImM x y : 'Im (x * y) = 'Re x * 'Im y + 'Re y * 'Im x. +Proof. +rewrite [x in LHS]Crect [y in LHS]Crect mulC_rect. +by rewrite !(Im_rect, rpredB, rpredD, rpredM). +Qed. + +Lemma ImMil x : 'Im ('i * x) = 'Re x. +Proof. by rewrite ImM Re_i Im_i mul0r mulr1 add0r. Qed. + +Lemma ReMil x : 'Re ('i * x) = - 'Im x. +Proof. by rewrite -ImMil mulrA mulCii mulN1r raddfN. Qed. + +Lemma ReMir x : 'Re (x * 'i) = - 'Im x. Proof. by rewrite mulrC ReMil. Qed. + +Lemma ImMir x : 'Im (x * 'i) = 'Re x. Proof. by rewrite mulrC ImMil. Qed. + +Lemma ReM x y : 'Re (x * y) = 'Re x * 'Re y - 'Im x * 'Im y. +Proof. by rewrite -ImMil mulrCA ImM ImMil ReMil mulNr ['Im _ * _]mulrC. Qed. + Lemma normC2_rect : {in real &, forall x y, `|x + 'i * y| ^+ 2 = x ^+ 2 + y ^+ 2}. Proof. @@ -4655,12 +4730,54 @@ Lemma normC2_Re_Im z : `|z| ^+ 2 = 'Re z ^+ 2 + 'Im z ^+ 2. Proof. by rewrite -normC2_rect -?Crect. Qed. +Lemma invC_Crect x y : (x + 'i * y)^-1 = (x^* - 'i * y^*) / `|x + 'i * y| ^+ 2. +Proof. by rewrite /= invC_norm mulrC !rmorphE rmorphM conjCi mulNr. Qed. + Lemma invC_rect : {in real &, forall x y, (x + 'i * y)^-1 = (x - 'i * y) / (x ^+ 2 + y ^+ 2)}. +Proof. by move=> x y Rx Ry; rewrite invC_Crect normC2_rect ?conj_Creal. Qed. + +Lemma ImV x : 'Im x^-1 = - 'Im x / `|x| ^+ 2. Proof. -by move=> x y Rx Ry; rewrite /= invC_norm conjC_rect // mulrC normC2_rect. +rewrite [x in LHS]Crect invC_rect// ImMr ?(rpredV, rpredD, rpredX)//. +by rewrite -mulrN Im_rect ?rpredN// -normC2_rect// -Crect. Qed. +Lemma ReV x : 'Re x^-1 = 'Re x / `|x| ^+ 2. +Proof. +rewrite [x in LHS]Crect invC_rect// ReMr ?(rpredV, rpredD, rpredX)//. +by rewrite -mulrN Re_rect ?rpredN// -normC2_rect// -Crect. +Qed. + +Lemma rectC_mulr x y z : (x + 'i * y) * z = x * z + 'i * (y * z). +Proof. by rewrite mulrDl mulrA. Qed. + +Lemma rectC_mull x y z : z * (x + 'i * y) = z * x + 'i * (z * y). +Proof. by rewrite mulrDr mulrCA. Qed. + +Lemma divC_Crect x1 y1 x2 y2 : + (x1 + 'i * y1) / (x2 + 'i * y2) = + (x1 * x2^* + y1 * y2^* + 'i * (x2^* * y1 - x1 * y2^*)) / + `|x2 + 'i * y2| ^+ 2. +Proof. +rewrite invC_Crect// -mulrN [_ / _]rectC_mulr mulC_rect !mulrA -mulrBl. +rewrite [_ * _ * y1]mulrAC -mulrDl mulrA -mulrDl !(mulrN, mulNr) opprK. +by rewrite [- _ + _]addrC. +Qed. + +Lemma divC_rect x1 y1 x2 y2 : + x1 \is real -> y1 \is real -> x2 \is real -> y2 \is real -> + (x1 + 'i * y1) / (x2 + 'i * y2) = + (x1 * x2 + y1 * y2 + 'i * (x2 * y1 - x1 * y2)) / + (x2 ^+ 2 + y2 ^+ 2). +Proof. by move=> *; rewrite divC_Crect normC2_rect ?conj_Creal. Qed. + +Lemma Im_div x y : 'Im (x / y) = ('Re y * 'Im x - 'Re x * 'Im y) / `|y| ^+ 2. +Proof. by rewrite ImM ImV ReV mulrA [X in _ + X]mulrAC -mulrDl mulrN addrC. Qed. + +Lemma Re_div x y : 'Re (x / y) = ('Re x * 'Re y + 'Im x * 'Im y) / `|y| ^+ 2. +Proof. by rewrite ReM ImV ReV !mulrA -mulrBl mulrN opprK. Qed. + Lemma leif_normC_Re_Creal z : `|'Re z| <= `|z| ?= iff (z \is real). Proof. rewrite -(mono_in_leif ler_sqr); try by rewrite qualifE. @@ -4696,17 +4813,10 @@ reflect (0 <= 'Im z -> 0 <= 'Im y /\ 'Re z <= 'Re y) (argCle y z). Proof. suffices dIm x: nnegIm x = (0 <= 'Im x). - rewrite /argCle !dIm ler_pmul2r ?invr_gt0 ?ltr0n //. + rewrite /argCle !dIm !(ImE, ReE) ler_pmul2r ?invr_gt0 ?ltr0n //. by apply: (iffP implyP) => geZyz /geZyz/andP. -by rewrite /('Im x) pmulr_lge0 ?invr_gt0 ?ltr0n //; congr (0 <= _ * _). +by rewrite (ImE x) pmulr_lge0 ?invr_gt0 ?ltr0n //; congr (0 <= _ * _). Qed. -(* case Du: sqrCi => [u u2N1] /=. *) -(* have/eqP := u2N1; rewrite -sqrCi eqf_sqr => /pred2P[] //. *) -(* have:= conjCi; rewrite /'i; case_rootC => /= v v2n1 min_v conj_v Duv. *) -(* have{min_v} /idPn[] := min_v u isT u2N1; rewrite negb_imply /nnegIm Du /= Duv. *) -(* rewrite rmorphN conj_v opprK -opprD mulrNN mulNr -mulr2n mulrnAr -expr2 v2n1. *) -(* by rewrite mulNrn opprK ler0n oppr_ge0 (ler_nat _ 2 0). *) - Lemma rootC_Re_max n x y : (n > 0)%N -> y ^+ n = x -> 0 <= 'Im y -> 'Re y <= 'Re (n.-root x). @@ -4960,7 +5070,7 @@ have def_xy: x * y^* = y * x^*. apply/eqP; rewrite -subr_eq0 -[_ == 0](@expf_eq0 _ _ 2). rewrite (canRL (subrK _) (subr_sqrDB _ _)) opprK -def2xy exprMn_n exprMn. - by rewrite mulrN (@GRing.mul C).[AC (2*2)%AC (1*4*(3*2))%AC] -!normCK mulNrn addNr. + by rewrite mulrN (@GRing.mul C).[AC (2*2) (1*4*(3*2))] -!normCK mulNrn addNr. have{def_xy def2xy} def_yx: `|y * x| = y * x^*. by apply: (mulIf nz2); rewrite !mulr_natr mulrC normrM def2xy def_xy. rewrite -{1}(divfK nz_x y) invC_norm mulrCA -{}def_yx !normrM invfM. @@ -5028,17 +5138,21 @@ End ClosedFieldTheory. -Notation "n .-root" := (@nthroot _ n) - (at level 2, format "n .-root") : ring_scope. +Notation "n .-root" := (@nthroot _ n). Notation sqrtC := 2.-root. -Notation "'i" := (@imaginaryC _) (at level 0) : ring_scope. -Notation "'Re z" := (Re z) (at level 10, z at level 8) : ring_scope. -Notation "'Im z" := (Im z) (at level 10, z at level 8) : ring_scope. +Notation "'i" := (@imaginaryC _) : ring_scope. +Notation "'Re z" := (Re z) : ring_scope. +Notation "'Im z" := (Im z) : ring_scope. Arguments conjCK {C} x. Arguments sqrCK {C} [x] le0x. Arguments sqrCK_P {C x}. +Hint Extern 0 (is_true (in_mem ('Re _) _)) => + solve [apply: Creal_Re] : core. +Hint Extern 0 (is_true (in_mem ('Im _) _)) => + solve [apply: Creal_Im] : core. + End Theory. (*************) @@ -5098,7 +5212,7 @@ Lemma lerr x : x <= x. Proof. -have n2: `|2%:R| == 2%:R :> R by rewrite -ge0_def ltW ?addr_gt0 ?lt01. +have n2: `|2| == 2 :> R by rewrite -ge0_def ltW ?addr_gt0 ?lt01. rewrite le_def subrr -(inj_eq (addrI `|0|)) addr0 -mulr2n -mulr_natr. by rewrite -(eqP n2) -normM mul0r. Qed. diff -Nru ssreflect-1.14.0/mathcomp/algebra/vector.v ssreflect-1.15.0/mathcomp/algebra/vector.v --- ssreflect-1.14.0/mathcomp/algebra/vector.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/algebra/vector.v 2022-06-30 08:50:47.000000000 +0000 @@ -1224,7 +1224,7 @@ End VectorTheory. -Hint Resolve subvv : core. +#[global] Hint Resolve subvv : core. Arguments subvP {K vT U V}. Arguments addv_idPl {K vT U V}. Arguments addv_idPr {K vT U V}. @@ -2046,6 +2046,3 @@ Qed. End Solver. - -#[deprecated(since="mathcomp 1.12.0", note="Use limgD instead.")] -Notation limg_add := limgD (only parsing). diff -Nru ssreflect-1.14.0/mathcomp/character/character.v ssreflect-1.15.0/mathcomp/character/character.v --- ssreflect-1.14.0/mathcomp/character/character.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/character/character.v 2022-06-30 08:50:47.000000000 +0000 @@ -85,9 +85,9 @@ Variable (F : fieldType). -Fixpoint trow (n1 : nat) : +Fixpoint trow (n1 : nat) : forall (A : 'rV[F]_n1) m2 n2 (B : 'M[F]_(m2,n2)), 'M[F]_(m2,n1 * n2) := - if n1 is n'1.+1 + if n1 is n'1.+1 then fun (A : 'M[F]_(1,(1 + n'1))) m2 n2 (B : 'M[F]_(m2,n2)) => (row_mx (lsubmx A 0 0 *: B) (trow (rsubmx A) B)) @@ -117,9 +117,9 @@ by rewrite linearD /= linearZ IH !mxE. Qed. -Canonical Structure trowb_linear n1 m2 n2 B := +Canonical Structure trowb_linear n1 m2 n2 B := Linear (@trowb_is_linear n1 m2 n2 B). - + Lemma trow_is_linear n1 m2 n2 (A : 'rV_n1) : linear (@trow n1 A m2 n2). Proof. elim: n1 A => [|n1 IH] //= A k A1 A2 /=; first by rewrite scaler0 add0r. @@ -128,13 +128,13 @@ by case: split=> a; rewrite ?IH !mxE. Qed. -Canonical Structure trow_linear n1 m2 n2 A := +Canonical Structure trow_linear n1 m2 n2 A := Linear (@trow_is_linear n1 m2 n2 A). -Fixpoint tprod (m1 : nat) : +Fixpoint tprod (m1 : nat) : forall n1 (A : 'M[F]_(m1,n1)) m2 n2 (B : 'M[F]_(m2,n2)), 'M[F]_(m1 * m2,n1 * n2) := - if m1 is m'1.+1 + if m1 is m'1.+1 return forall n1 (A : 'M[F]_(m1,n1)) m2 n2 (B : 'M[F]_(m2,n2)), 'M[F]_(m1 * m2,n1 * n2) then @@ -155,8 +155,8 @@ by apply/matrixP=> i j /[!mxE]; apply: eq_bigr=> k _ /[!mxE]. Qed. -Let trow_mul (m1 m2 n2 p2 : nat) - (A : 'rV_m1) (B1: 'M[F]_(m2,n2)) (B2 :'M[F]_(n2,p2)) : +Let trow_mul (m1 m2 n2 p2 : nat) + (A : 'rV_m1) (B1: 'M[F]_(m2,n2)) (B2 :'M[F]_(n2,p2)) : trow A (B1 *m B2) = B1 *m trow A B2. Proof. elim: m1 A => [|m1 IH] A /=; first by rewrite mulmx0. @@ -255,7 +255,7 @@ Definition grepr0 := Representation (MxRepresentation mx_repr0). -Lemma add_mx_repr (rG1 rG2 : representation) : +Lemma add_mx_repr (rG1 rG2 : representation) : mx_repr G (fun g => block_mx (rG1 g) 0 0 (rG2 g)). Proof. split=> [|x y Hx Hy]; first by rewrite !repr_mx1 -scalar_mx_block. @@ -311,8 +311,8 @@ Qed. Lemma mx_rsim_dsum (I : finType) (P : pred I) U rU (W : 'M_n) - (modU : forall i, mxmodule rG (U i)) (modW : mxmodule rG W) : - let S := (\sum_(i | P i) U i)%MS in (S :=: W)%MS -> mxdirect S -> + (modU : forall i, mxmodule rG (U i)) (modW : mxmodule rG W) : + let S := (\sum_(i | P i) U i)%MS in (S :=: W)%MS -> mxdirect S -> (forall i, mx_rsim (submod_repr (modU i)) (rU i : representation)) -> mx_rsim (submod_repr modW) (\big[dadd_grepr/grepr0]_(i | P i) rU i). Proof. @@ -1270,7 +1270,7 @@ Let uX := character_table_unit. (* This is Isaacs, Theorem (2.18). *) -Theorem second_orthogonality_relation x y : +Theorem second_orthogonality_relation x y : y \in G -> \sum_i 'chi[G]_i x * ('chi_i y)^* = #|'C_G[x]|%:R *+ (x \in y ^: G). Proof. @@ -1302,7 +1302,7 @@ (* This is Isaacs, Theorem (6.32) (due to Brauer). *) Lemma card_afix_irr_classes (ito : action A (Iirr G)) (cto : action A _) a : - a \in A -> [acts A, on classes G | cto] -> + a \in A -> [acts A, on classes G | cto] -> (forall i x y, x \in G -> y \in cto (x ^: G) a -> 'chi_i x = 'chi_(ito i a) y) -> #|'Fix_ito[a]| = #|'Fix_(classes G | cto)[a]|. @@ -1380,7 +1380,7 @@ phi \is a character -> '[phi, 'chi_i]_G \in Cnat. Proof. by move/forallP/(_ i); rewrite coord_cfdot. Qed. -Lemma cfdot_char_r phi chi : +Lemma cfdot_char_r phi chi : chi \is a character -> '[phi, chi]_G = \sum_i '[phi, 'chi_i] * '[chi, 'chi_i]. Proof. move=> Nchi; rewrite cfdot_sum_irr; apply: eq_bigr => i _; congr (_ * _). @@ -1393,7 +1393,7 @@ move=> Nchi Nxi; rewrite cfdot_char_r ?rpred_sum // => i _. by rewrite rpredM ?Cnat_cfdot_char_irr. Qed. - + Lemma cfdotC_char chi xi : chi \is a character-> xi \is a character -> '[chi, xi]_G = '[xi, chi]. Proof. by move=> Nchi Nxi; rewrite cfdotC conj_Cnat ?Cnat_cfdot_char. Qed. @@ -1544,14 +1544,14 @@ by move=> j; rewrite !inE cfdot_irr pnatr_eq0 (eq_sym j); case: (i == j). Qed. -Lemma char1_ge_constt (i : Iirr G) chi : +Lemma char1_ge_constt (i : Iirr G) chi : chi \is a character -> i \in irr_constt chi -> 'chi_i 1%g <= chi 1%g. Proof. move=> {chi} _ /constt_charP[// | chi Nchi ->]. by rewrite cfunE addrC -subr_ge0 addrK char1_ge0. Qed. -Lemma constt_ortho_char (phi psi : 'CF(G)) i j : +Lemma constt_ortho_char (phi psi : 'CF(G)) i j : phi \is a character -> psi \is a character -> i \in irr_constt phi -> j \in irr_constt psi -> '[phi, psi] = 0 -> '['chi_i, 'chi_j] = 0. @@ -1571,7 +1571,7 @@ Variable (gT : finGroupType) (G : {group gT}). Implicit Types (phi chi xi : 'CF(G)) (H : {group gT}). -Lemma cfker_repr n (rG : mx_representation algCF G n) : +Lemma cfker_repr n (rG : mx_representation algCF G n) : cfker (cfRepr rG) = rker rG. Proof. apply/esym/setP=> x; rewrite inE mul1mx /=. @@ -1580,7 +1580,7 @@ rewrite inE Gx; apply/forallP=> y; rewrite !cfunE !mulrb groupMl //. by case: ifP => // Gy; rewrite repr_mxM // Kx mul1mx. Qed. - + Lemma cfkerEchar chi : chi \is a character -> cfker chi = [set x in G | chi x == chi 1%g]. Proof. @@ -1743,7 +1743,7 @@ Proof. by rewrite !irr_consttE cfdotC conjC_eq0 -cfdot_Res_l. Qed. Lemma cfdot_Res_ge_constt i j psi : - psi \is a character -> j \in irr_constt psi -> + psi \is a character -> j \in irr_constt psi -> '['Res[H, G] 'chi_j, 'chi_i] <= '['Res[H] psi, 'chi_i]. Proof. move=> {psi} _ /constt_charP[// | psi Npsi ->]. @@ -1752,7 +1752,7 @@ Qed. Lemma constt_Res_trans j psi : - psi \is a character -> j \in irr_constt psi -> + psi \is a character -> j \in irr_constt psi -> {subset irr_constt ('Res[H, G] 'chi_j) <= irr_constt ('Res[H] psi)}. Proof. move=> Npsi Cj i; apply: contraNneq; rewrite eq_le => {1}<-. @@ -2204,7 +2204,7 @@ Lemma conjC_irrAut u i x : (u ('chi[G]_i x))^* = u ('chi_i x)^*. Proof. exact: conjC_charAut (irr_char i). Qed. -Lemma cfdot_aut_char u (phi chi : 'CF(G)) : +Lemma cfdot_aut_char u (phi chi : 'CF(G)) : chi \is a character -> '[cfAut u phi, cfAut u chi] = u '[phi, chi]. Proof. by move/conjC_charAut=> Nchi; apply: cfdot_cfAut => _ /mapP[x _ ->]. Qed. @@ -2436,7 +2436,7 @@ by rewrite i0 irr0 !cfun1E Gx group1. Qed. -(* This is Isaacs (2.23)(a). *) +(* This is Isaacs (2.23)(a). *) Lemma cap_cfker_lin_irr G : \bigcap_(i | 'chi[G]_i \is a linear_char) (cfker 'chi_i) = G^`(1)%g. Proof. @@ -2452,7 +2452,7 @@ rewrite -(on_card_preimset (mod_Iirr_bij nsG'G)). rewrite -card_quotient ?normal_norm //. move: (der_abelian 0 G); rewrite card_classes_abelian; move/eqP<-. -rewrite -NirrE -[X in _ = X]card_ord. +rewrite -NirrE -[RHS]card_ord. by apply: eq_card => i; rewrite !inE mod_IirrE ?cfker_mod. (* Alternative: use the equivalent result in modular representation theory transitivity #|@socle_of_Iirr _ G @^-1: linear_irr _|; last first. @@ -2476,7 +2476,7 @@ (* A combinatorial group isommorphic to the linear characters. *) Lemma lin_char_group G : - {linG : finGroupType & {cF : linG -> 'CF(G) | + {linG : finGroupType & {cF : linG -> 'CF(G) | [/\ injective cF, #|linG| = #|G : G^`(1)|, forall u, cF u \is a linear_char & forall phi, phi \is a linear_char -> exists u, phi = cF u] @@ -2539,7 +2539,7 @@ Qed. (* This is Isaacs (2.24). *) -Lemma card_subcent1_coset G H x : +Lemma card_subcent1_coset G H x : x \in G -> H <| G -> (#|'C_(G / H)[coset H x]| <= #|'C_G[x]|)%N. Proof. move=> Gx nsHG; rewrite -leC_nat. @@ -2705,7 +2705,7 @@ End CfDetOps. -Definition cfcenter (gT : finGroupType) (G : {set gT}) (phi : 'CF(G)) := +Definition cfcenter (gT : finGroupType) (G : {set gT}) (phi : 'CF(G)) := if phi \is a character then [set g in G | `|phi g| == phi 1%g] else cfker phi. Notation "''Z' ( phi )" := (cfcenter phi) : cfun_scope. @@ -2716,7 +2716,7 @@ Implicit Types (phi chi : 'CF(G)) (H : {group gT}). (* This is Isaacs (2.27)(a). *) -Lemma cfcenter_repr n (rG : mx_representation algCF G n) : +Lemma cfcenter_repr n (rG : mx_representation algCF G n) : 'Z(cfRepr rG)%CF = rcenter rG. Proof. rewrite /cfcenter /rcenter cfRepr_char /=. @@ -2813,7 +2813,7 @@ Qed. (* This is Isaacs (2.27)(e). *) -Lemma cfcenter_subset_center chi : +Lemma cfcenter_subset_center chi : ('Z(chi)%CF / cfker chi)%g \subset 'Z(G / cfker chi)%g. Proof. case Nchi: (chi \is a character); last first. @@ -2826,7 +2826,7 @@ Qed. (* This is Isaacs (2.27)(f). *) -Lemma cfcenter_eq_center (i : Iirr G) : +Lemma cfcenter_eq_center (i : Iirr G) : ('Z('chi_i)%CF / cfker 'chi_i)%g = 'Z(G / cfker 'chi_i)%g. Proof. apply/eqP; rewrite eqEsubset; rewrite cfcenter_subset_center ?irr_char //. @@ -2883,7 +2883,7 @@ by rewrite mulr1 irr1_degree conjC_nat. by rewrite cfdot_irr eqxx mulr1. Qed. - + (* This is Isaacs (2.31). *) Lemma irr1_abelian_bound (i : Iirr G) : abelian (G / 'Z('chi_i)%CF) -> ('chi_i 1%g) ^+ 2 = #|G : 'Z('chi_i)%CF|%:R. @@ -2920,7 +2920,7 @@ Qed. (* This is Isaacs (2.32)(b). *) -Lemma pgroup_cyclic_faithful (p : nat) : +Lemma pgroup_cyclic_faithful (p : nat) : p.-group G -> cyclic 'Z(G) -> exists i, cfaithful 'chi[G]_i. Proof. pose Z := 'Ohm_1('Z(G)) => pG cycZG; have nilG := pgroup_nil pG. diff -Nru ssreflect-1.14.0/mathcomp/character/classfun.v ssreflect-1.15.0/mathcomp/character/classfun.v --- ssreflect-1.14.0/mathcomp/character/classfun.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/character/classfun.v 2022-06-30 08:50:47.000000000 +0000 @@ -755,7 +755,7 @@ Arguments cfun_onP {gT G A phi}. Arguments cfConjCK {gT G} phi : rename. -Hint Resolve cfun_onT : core. +#[global] Hint Resolve cfun_onT : core. Section DotProduct. @@ -977,8 +977,8 @@ rewrite -mulr_natr -[_ + _](divfK (negbT (eqC_nat 2 0))) -/('Re _). rewrite (mono_leif (ler_pmul2r _)) ?ltr0n //. have:= leif_trans (leif_Re_Creal '[phi, psi]) (cfCauchySchwarz_sqrt phi psi). -congr (_ <= _ ?= iff _); apply: andb_id2r. -rewrite free_cons span_seq1 seq1_free -negb_or negbK orbC. +congr (_ <= _ ?= iff _); first by rewrite ReE. +apply: andb_id2r; rewrite free_cons span_seq1 seq1_free -negb_or negbK orbC /=. have [-> | nz_psi] := eqVneq psi 0; first by rewrite cfdot0r coord0. case/vlineP=> [x ->]; rewrite cfdotZl linearZ pmulr_lge0 ?cfnorm_gt0 //=. by rewrite (coord_free 0) ?seq1_free // eqxx mulr1. @@ -2489,6 +2489,3 @@ Definition conj_cfMod := cfAutMod conjC. Definition conj_cfInd := cfAutInd conjC. Definition cfconjC_eq1 := cfAut_eq1 conjC. - -#[deprecated(since="mathcomp 1.11.0", note="Use cf_triangle_leif instead.")] -Notation cf_triangle_lerif := cf_triangle_leif (only parsing). diff -Nru ssreflect-1.14.0/mathcomp/character/inertia.v ssreflect-1.15.0/mathcomp/character/inertia.v --- ssreflect-1.14.0/mathcomp/character/inertia.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/character/inertia.v 2022-06-30 08:50:47.000000000 +0000 @@ -170,7 +170,7 @@ Variable gT : finGroupType. -Definition inertia (B : {set gT}) (phi : 'CF(B)) := +Definition inertia (B : {set gT}) (phi : 'CF(B)) := [set y in 'N(B) | (phi ^ y)%CF == phi]. Local Notation "''I[' phi ]" := (inertia phi) : group_scope. @@ -380,7 +380,7 @@ by rewrite -{1}['chi_i]cfConjgJ1 cfConjg_eqE ?mulg1. Qed. -Definition cfclass (A : {set gT}) (phi : 'CF(A)) (B : {set gT}) := +Definition cfclass (A : {set gT}) (phi : 'CF(A)) (B : {set gT}) := [seq (phi ^ repr Tx)%CF | Tx in rcosets 'I_B[phi] B]. Local Notation "phi ^: G" := (cfclass phi G) : cfun_scope. @@ -498,7 +498,7 @@ (* This is Isaacs, Theorem (6.2) *) Lemma Clifford_Res_sum_cfclass i j : H <| G -> j \in irr_constt ('Res[H, G] 'chi_i) -> - 'Res[H] 'chi_i = + 'Res[H] 'chi_i = '['Res[H] 'chi_i, 'chi_j] *: (\sum_(chi <- ('chi_j ^: G)%CF) chi). Proof. move=> nsHG chiHj; have [sHG /subsetP nHG] := andP nsHG. @@ -1063,7 +1063,7 @@ apply: sumr_ge0 => g /andP[Sg _]; rewrite cfdotZl cfdot_irr. by rewrite mulr_ge0 ?ler0n ?Cnat_ge0. Qed. - + (* This is Isaacs, Corollary (6.17) (due to Gallagher). *) Corollary constt_Ind_ext : [/\ forall b : Iirr (G / N), 'chi_(mod_Iirr b) * chi \in irr G, @@ -1175,7 +1175,7 @@ rewrite ler_paddr ?sumr_ge0 // => [i _|]. by rewrite char1_ge0 ?rpredZ_Cnat ?Cnat_cfdot_char ?cfInd_char ?irr_char. rewrite -big_uniq //= big_image -sumr_const ler_sum // => i _. - rewrite cfunE -[in rhs in _ <= rhs](cfRes1 L) -cfdot_Res_r mmLthL cfRes1. + rewrite cfunE -[in leRHS](cfRes1 L) -cfdot_Res_r mmLthL cfRes1. by rewrite DthL cfdotZr rmorph_nat cfnorm_irr mulr1. constructor 2; exists e; first by exists p0. pose mu := (('chi_i / 'chi_j)%R %% L)%CF; pose U := cfker mu. @@ -1299,7 +1299,7 @@ by rewrite Dc2 cfIirrE // mod_IirrE. have s2_lin: 'chi_s2 \is a linear_char. rewrite qualifE irr_char; apply/eqP/(mulIf (irr1_neq0 c)). - rewrite mul1r -[in rhs in _ = rhs](cfRes1 N) chiN -c2Nth cfRes1. + rewrite mul1r -[in RHS](cfRes1 N) chiN -c2Nth cfRes1. by rewrite Dc2 cfunE cfMod1. have s2Xf_1: 'chi_s2 ^+ f = 1. apply/(can_inj (cfModK nsNG))/(mulIr (lin_char_unitr lin_mu))/esym. @@ -1313,7 +1313,7 @@ (* This is Isaacs, Theorem (6.25). *) Theorem solvable_irr_extendible_from_det G N s (theta := 'chi[N]_s) : N <| G -> solvable (G / N) -> - G \subset 'I[theta] -> coprime #|G : N| (truncC (theta 1%g)) -> + G \subset 'I[theta] -> coprime #|G : N| (truncC (theta 1%g)) -> [exists c, 'Res 'chi[G]_c == theta] = [exists u, 'Res 'chi[G]_u == cfDet theta]. Proof. diff -Nru ssreflect-1.14.0/mathcomp/character/integral_char.v ssreflect-1.15.0/mathcomp/character/integral_char.v --- ssreflect-1.14.0/mathcomp/character/integral_char.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/character/integral_char.v 2022-06-30 08:50:47.000000000 +0000 @@ -325,7 +325,7 @@ have{p_natC} [p p_pr [a Dm]]: {p : nat & prime p & {a | m = p ^ a}%N}. have /prod_prime_decomp->: (0 < m)%N by rewrite /m -index_cent1. rewrite prime_decompE; case Dpr: (primes _) p_natC => [|p []] // _. - by exists 2 => //; rewrite big_nil; exists 0%N. + by exists 2%N => //; rewrite big_nil; exists 0%N. rewrite big_seq1; exists p; last by exists (logn p m). by have:= mem_primes p m; rewrite Dpr mem_head => /esym/and3P[]. have{simpleG} [ntG minG] := simpleP _ simpleG. diff -Nru ssreflect-1.14.0/mathcomp/character/Make ssreflect-1.15.0/mathcomp/character/Make --- ssreflect-1.14.0/mathcomp/character/Make 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/character/Make 2022-06-30 08:50:47.000000000 +0000 @@ -15,5 +15,3 @@ -arg -w -arg +duplicate-clear -arg -w -arg -ambiguous-paths -arg -w -arg +undeclared-scope --arg -w -arg -deprecated-hint-without-locality --arg -w -arg -deprecated-ident-entry diff -Nru ssreflect-1.14.0/mathcomp/character/mxabelem.v ssreflect-1.15.0/mathcomp/character/mxabelem.v --- ssreflect-1.14.0/mathcomp/character/mxabelem.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/character/mxabelem.v 2022-06-30 08:50:47.000000000 +0000 @@ -234,7 +234,7 @@ Qed. Lemma cprod_rowg m1 m2 (A : 'M_(m1, n)) (B : 'M_(m2, n)) : - rowg A \* rowg B = rowg (A + B)%MS. + (rowg A \* rowg B)%g = rowg (A + B)%MS. Proof. by rewrite rowgD cprodE // (sub_abelian_cent2 (zmod_abelian setT)). Qed. Lemma dprod_rowg m1 m2 (A : 'M[F]_(m1, n)) (B : 'M[F]_(m2, n)) : @@ -358,7 +358,7 @@ Lemma rank_mx_group m n q : 'r([set: 'M['Z_q]_(m, n)]) = (m * n)%N. Proof. -wlog q_gt1: q / q > 1 by case: q => [|[|q -> //]] /(_ 2)->. +wlog q_gt1: q / q > 1 by case: q => [|[|q -> //]] /(_ 2%N)->. set G := setT; have cGG: abelian G := zmod_abelian _. have [mn0 | ] := posnP (m * n). by rewrite [G](card1_trivg _) ?rank1 // cardsT card_mx mn0. @@ -379,7 +379,7 @@ Lemma mx_group_homocyclic m n q : homocyclic [set: 'M['Z_q]_(m, n)]. Proof. -wlog q_gt1: q / q > 1 by case: q => [|[|q -> //]] /(_ 2)->. +wlog q_gt1: q / q > 1 by case: q => [|[|q -> //]] /(_ 2%N)->. set G := setT; have cGG: abelian G := zmod_abelian _. rewrite -max_card_abelian //= rank_mx_group cardsT card_mx card_ord -/G. rewrite {1}Zp_cast //; have [-> // | ] := posnP (m * n). diff -Nru ssreflect-1.14.0/mathcomp/character/vcharacter.v ssreflect-1.15.0/mathcomp/character/vcharacter.v --- ssreflect-1.14.0/mathcomp/character/vcharacter.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/character/vcharacter.v 2022-06-30 08:50:47.000000000 +0000 @@ -486,7 +486,7 @@ Qed. Lemma vchar_norm2 phi : - phi \in 'Z[irr G, G^#] -> '[phi] = 2%:R -> + phi \in 'Z[irr G, G^#] -> '[phi] = 2 -> exists i, exists2 j, j != i & phi = 'chi_i - 'chi_j. Proof. rewrite zchar_split cfunD1E => /andP[Zphi phi1_0]. diff -Nru ssreflect-1.14.0/mathcomp/_CoqProject ssreflect-1.15.0/mathcomp/_CoqProject --- ssreflect-1.14.0/mathcomp/_CoqProject 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/_CoqProject 2022-06-30 08:50:47.000000000 +0000 @@ -7,5 +7,4 @@ -arg -w -arg +duplicate-clear -arg -w -arg +non-primitive-record -arg -w -arg +undeclared-scope --arg -w -arg -deprecated-hint-without-locality --arg -w -arg -deprecated-ident-entry +-arg -w -arg -deprecated-hint-rewrite-without-locality diff -Nru ssreflect-1.14.0/mathcomp/field/algC.v ssreflect-1.15.0/mathcomp/field/algC.v --- ssreflect-1.14.0/mathcomp/field/algC.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/field/algC.v 2022-06-30 08:50:47.000000000 +0000 @@ -71,13 +71,13 @@ apply/eqP=> char2; apply: conj_nt => e; apply/eqP/idPn=> eJ. have opp_id x: - x = x :> L. by apply/esym/eqP; rewrite -addr_eq0 -mulr2n -mulr_natl char2 mul0r. - have{} char2: 2 \in [char L] by apply/eqP. + have{} char2: 2%N \in [char L] by apply/eqP. without loss{eJ} eJ: e / conj e = e + 1. move/(_ (e / (e + conj e))); apply. rewrite fmorph_div rmorphD conjK -{1}[conj e](addNKr e) mulrDl. by rewrite opp_id (addrC e) divff // addr_eq0 opp_id. pose a := e * conj e; have aJ: conj a = a by rewrite rmorphM conjK mulrC. - have [w Dw] := @solve_monicpoly _ 2 (nth 0 [:: e * a; - 1]) isT. + have [w Dw] := @solve_monicpoly _ 2%N (nth 0 [:: e * a; - 1]) isT. have{} Dw: w ^+ 2 + w = e * a. by rewrite Dw !big_ord_recl big_ord0 /= mulr1 mulN1r addr0 subrK. pose b := w + conj w; have bJ: conj b = b by rewrite rmorphD conjK addrC. @@ -92,7 +92,7 @@ by rewrite {2}eJ rmorphD rmorph1. have mul2I: injective (fun z : L => z *+ 2). by move=> x y; rewrite /= -mulr_natl -(mulr_natl y) => /mulfI->. -pose sqrt x : L := sval (sig_eqW (@solve_monicpoly _ 2 (nth 0 [:: x]) isT)). +pose sqrt x : L := sval (sig_eqW (@solve_monicpoly _ 2%N (nth 0 [:: x]) isT)). have sqrtK x: sqrt x ^+ 2 = x. rewrite /sqrt; case: sig_eqW => /= y ->. by rewrite !big_ord_recl big_ord0 /= mulr1 mul0r !addr0. @@ -110,7 +110,7 @@ have [-> | nz_z] := eqVneq z 0; first exact: rmorph0. have [u Ru [v Rv Dz]]: exists2 u, conj u = u & exists2 v, conj v = v & (u + z * v) ^+ 2 = z. - - pose y := sqrt z; exists ((y + conj y) / 2%:R). + - pose y := sqrt z; exists ((y + conj y) / 2). by rewrite fmorph_div rmorphD conjK addrC rmorph_nat. exists ((y - conj y) / (z *+ 2)). rewrite fmorph_div rmorphMn zJ mulNrn invrN mulrN -mulNr rmorphB opprB. @@ -425,7 +425,7 @@ Fact conj_nt : ~ conj =1 id. Proof. have [i i2]: exists i : type, i ^+ 2 = -1. - have [i] := @solve_monicpoly _ 2 (nth 0 [:: -1 : type]) isT. + have [i] := @solve_monicpoly _ 2%N (nth 0 [:: -1 : type]) isT. by rewrite !big_ord_recl big_ord0 /= mul0r mulr1 !addr0; exists i. move/(_ i)/(congr1 CtoL); rewrite LtoC_K => iL_J. have/lt_geF/idP[] := @ltr01 Lnum; rewrite -oppr_ge0 -(rmorphN1 CtoL_rmorphism). @@ -615,7 +615,7 @@ Local Notation pQtoC := (map_poly ratr). Let intr_inj_ZtoC := (intr_inj : injective ZtoC). -Local Hint Resolve intr_inj_ZtoC : core. +#[local] Hint Resolve intr_inj_ZtoC : core. (* Specialization of a few basic ssrnum order lemmas. *) @@ -625,7 +625,7 @@ Definition Cchar : [char algC] =i pred0 := @char_num _. (* This can be used in the converse direction to evaluate assertions over *) -(* manifest rationals, such as 3%:R^-1 + 7%:%^-1 < 2%:%^-1 :> algC. *) +(* manifest rationals, such as 3^-1 + 7%:%^-1 < 2%:%^-1 :> algC. *) (* Missing norm and integer exponent, due to gaps in ssrint and rat. *) Definition CratrE := let CnF := Algebraics.Implementation.numFieldType in @@ -643,7 +643,7 @@ (rmorphMz ZtoCm, @intr_norm CnF, @intr_sg CnF), =^~ (@ler_int CnF, @ltr_int CnF, (inj_eq (@intr_inj CnF)))). -Let nz2 : 2%:R != 0 :> algC. Proof. by rewrite -!CintrE. Qed. +Let nz2 : 2 != 0 :> algC. Proof. by rewrite -!CintrE. Qed. (* Conjugation and norm. *) @@ -946,7 +946,7 @@ Proof. move=> x_ge0 y_ge0 x_dv_y; apply: sig_eqW. case/dvdCP: x_dv_y => z Zz -> in y_ge0 *; move: x_ge0 y_ge0 Zz. -rewrite le_eqVlt => /predU1P[<- | ]; first by exists 22; rewrite !mulr0. +rewrite le_eqVlt => /predU1P[<- | ]; first by exists 22%N; rewrite !mulr0. by move=> /pmulr_lge0-> /CintEge0-> /CnatP[n ->]; exists n. Qed. @@ -1246,5 +1246,6 @@ End PredCmod. End AlgebraicsTheory. -Hint Resolve Creal0 Creal1 Cnat_nat Cnat0 Cnat1 Cint0 Cint1 floorC0 Crat0 Crat1 : core. -Hint Resolve dvdC0 dvdC_refl eqCmod_refl eqCmodm0 : core. +#[global] Hint Resolve Creal0 Creal1 Cnat_nat Cnat0 Cnat1 Cint0 Cint1 : core. +#[global] Hint Resolve floorC0 Crat0 Crat1 : core. +#[global] Hint Resolve dvdC0 dvdC_refl eqCmod_refl eqCmodm0 : core. diff -Nru ssreflect-1.14.0/mathcomp/field/algebraics_fundamentals.v ssreflect-1.15.0/mathcomp/field/algebraics_fundamentals.v --- ssreflect-1.14.0/mathcomp/field/algebraics_fundamentals.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/field/algebraics_fundamentals.v 2022-06-30 08:50:47.000000000 +0000 @@ -426,7 +426,7 @@ rewrite -/p1 {1}/eqp dvdp_gcd => /and3P[_ _ /dvdp_leq/=/implyP]. rewrite size_minPoly ltnNge size_poly (contraNneq _ nz_v) // => q1v0. by rewrite -(fmorph_eq0 [rmorphism of Qyz]) /= QyzE q1v0 horner0. - pose h2 : R := 2%:R^-1; have nz2: 2%:R != 0 :> R by rewrite pnatr_eq0. + pose h2 : R := 2^-1; have nz2: 2 != 0 :> R by rewrite pnatr_eq0. pose itv ab := [pred c : R | ab.1 <= c <= ab.2]. pose wid ab : R := ab.2 - ab.1; pose mid ab := (ab.1 + ab.2) * h2. pose sub_itv ab cd := cd.1 <= ab.1 :> R /\ ab.2 <= cd.2 :> R. @@ -627,7 +627,7 @@ suffices /eqP <-: - QxR v ^+ 2 == 1 by rewrite oppr_gt0 -leNgt sqr_ge0. rewrite -rmorphX -rmorphN fmorph_eq1 -(fmorph_eq1 (ofQ x)) rmorphN eqr_oppLR. by rewrite rmorphX Di Di2. -have szX2_1: size ('X^2 + 1) = 3. +have szX2_1: size ('X^2 + 1) = 3%N. by move=> R; rewrite size_addl ?size_polyXn ?size_poly1. have minp_i n (p_i := minPoly (R_ n) (i_ n)): p_i = 'X^2 + 1. have p_dv_X2_1: p_i %| 'X^2 + 1. @@ -663,7 +663,7 @@ have Dit: ofQ t i_t = i by rewrite CnQtE inQ_K. have Dit2: i_t ^+ 2 = -1. by apply: (fmorph_inj (ofQ t)); rewrite rmorphX rmorphN1 Dit. - have dimCn: \dim_Rn Cn = 2. + have dimCn: \dim_Rn Cn = 2%N. rewrite -adjoin_degreeE adjoin_degree_aimg. by apply: succn_inj; rewrite -size_minPoly minp_i. have /sQ_inQ[u_z Dz] := t_z; pose Rz := <>%AS. @@ -761,8 +761,8 @@ rewrite size_minPoly /= adjoin_degreeE (@pnat_dvd _ 2) // -dimCn. rewrite dvdn_divLR ?divnK ?adim_gt0 ?field_dimS ?subv_adjoin //. exact/FadjoinP. - have [w Rz_w deg_w]: exists2 w, w \in Rz & adjoin_degree Cn w = 2. - have [P sPG iPG]: exists2 P : {group gal_of Rz}, P \subset G & #|G : P| = 2. + have [w Rz_w deg_w]: exists2 w, w \in Rz & adjoin_degree Cn w = 2%N. + have [P sPG iPG]: exists2 P : {group gal_of Rz}, P \subset G & #|G : P| = 2%N. have [_ _ [k oG]] := pgroup_pdiv evenG ntG. have [P [sPG _ oP]] := normal_pgroup evenG (normal_refl G) (leq_pred _). by exists P => //; rewrite -divgS // oP oG pfactorK // -expnB ?subSnn. @@ -771,9 +771,9 @@ rewrite adjoin_degreeE -iPG -dim_fixed_galois // -defQw; congr (\dim_Cn _). apply/esym/eqP; rewrite eqEsubv adjoinSl ?sub1v //=; apply/FadjoinP. by rewrite memv_adjoin /= defQw -galois_connection. - have nz2: 2%:R != 0 :> Qt by move/charf0P: (charQ (Q t)) => ->. + have nz2: 2 != 0 :> Qt by move/charf0P: (charQ (Q t)) => ->. without loss{deg_w} [C'w Cw2]: w Rz_w / w \notin Cn /\ w ^+ 2 \in Cn. - pose p := minPoly Cn w; pose v := p`_1 / 2%:R. + pose p := minPoly Cn w; pose v := p`_1 / 2. have /polyOverP Cp: p \is a polyOver Cn := minPolyOver Cn w. have Cv: v \in Cn by rewrite rpred_div ?rpred_nat ?Cp. move/(_ (v + w)); apply; first by rewrite rpredD // subvP_adjoin. @@ -793,11 +793,11 @@ by rewrite exprMn rpredM // rpredX. rewrite exprMn fpredMr //=; last by rewrite expf_eq0 (memPnC C'w) ?rpred0. by rewrite sqrrD Dit2 expr1n addrC addKr -mulrnAl fpredMl ?rpred_nat. - pose rect_w2 u v := [/\ u \in Rn, v \in Rn & u + i_t * (v * 2%:R) = w ^+ 2]. + pose rect_w2 u v := [/\ u \in Rn, v \in Rn & u + i_t * (v * 2) = w ^+ 2]. have{Cw2} [u [v [Ru Rv Dw2]]]: {u : Qt & {v | rect_w2 u v}}. rewrite /rect_w2 -(Fadjoin_poly_eq Cw2); set p := Fadjoin_poly Rn i_t _. have /polyOverP Rp: p \is a polyOver Rn by apply: Fadjoin_polyOver. - exists p`_0, (p`_1 / 2%:R); split; rewrite ?rpred_div ?rpred_nat //. + exists p`_0, (p`_1 / 2); split; rewrite ?rpred_div ?rpred_nat //. rewrite divfK // (horner_coef_wide _ (size_Fadjoin_poly _ _ _)) -/p. by rewrite adjoin_degreeE dimCn big_ord_recl big_ord1 mulr1 mulrC. pose p := Poly [:: - (ofQ t v ^+ 2); 0; - ofQ t u; 0; 1]. diff -Nru ssreflect-1.14.0/mathcomp/field/algnum.v ssreflect-1.15.0/mathcomp/field/algnum.v --- ssreflect-1.14.0/mathcomp/field/algnum.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/field/algnum.v 2022-06-30 08:50:47.000000000 +0000 @@ -57,7 +57,7 @@ Local Notation pQtoC := (map_poly ratr). Local Definition intr_inj_ZtoC := (intr_inj : injective ZtoC). -Local Hint Resolve intr_inj_ZtoC : core. +#[local] Hint Resolve intr_inj_ZtoC : core. Local Notation QtoCm := [rmorphism of QtoC]. (* Number fields and rational spans. *) @@ -66,7 +66,7 @@ & exists ps, s = [seq (pQtoC p).[z] | p <- ps]}. Proof. elim: s => [|x s [z /sig_eqW[a Dz] /sig_eqW[ps Ds]]]. - by exists 0; [exists [ffun _ => 2]; rewrite big_ord0 | exists nil]. + by exists 0; [exists [ffun _ => 2%N]; rewrite big_ord0 | exists nil]. have r_exists (y : algC): {r | r != 0 & root (pQtoC r) y}. have [r [_ mon_r] dv_r] := minCpolyP y. by exists r; rewrite ?monic_neq0 ?dv_r. @@ -551,7 +551,7 @@ Lemma Aint0 : 0 \in Aint. Proof. exact: (Aint_int 0). Qed. Lemma Aint1 : 1 \in Aint. Proof. exact: (Aint_int 1). Qed. -Hint Resolve Aint0 Aint1 : core. +#[global] Hint Resolve Aint0 Aint1 : core. Lemma Aint_unity_root n x : (n > 0)%N -> n.-unity_root x -> x \in Aint. Proof. @@ -703,7 +703,7 @@ Lemma eqAmod_refl e x : (x == x %[mod e])%A. Proof. by rewrite /eqAmod subrr rpred0. Qed. -Hint Resolve eqAmod_refl : core. +#[global] Hint Resolve eqAmod_refl : core. Lemma eqAmod_sym e x y : ((x == y %[mod e]) = (y == x %[mod e]))%A. Proof. by rewrite /eqAmod -opprB rpredN. Qed. @@ -740,7 +740,7 @@ Lemma eqAmodm0 e : (e == 0 %[mod e])%A. Proof. by rewrite /eqAmod subr0 unfold_in; case: ifPn => // /divff->. Qed. -Hint Resolve eqAmodm0 : core. +#[global] Hint Resolve eqAmodm0 : core. Lemma eqAmodMr e : {in Aint, forall z x y, x == y %[mod e] -> x * z == y * z %[mod e]}%A. @@ -819,7 +819,7 @@ by rewrite /= -/p Dp -Cintr_Cyclotomic. rewrite Dp size_cyclotomic (sqrnD 1) addnAC mulnDr -add1n leq_add //. suffices: (m <= \prod_(q <- primes m | q == 2) q * totient m ^ 2)%N. - have [m_even | m_odd] := boolP (2 \in primes m). + have [m_even | m_odd] := boolP (2%N \in primes m). by rewrite -big_filter filter_pred1_uniq ?primes_uniq // big_seq1. by rewrite big_hasC ?has_pred1 // => /leq_trans-> //; apply: leq_addl. rewrite big_mkcond totientE // -mulnn -!big_split /=. diff -Nru ssreflect-1.14.0/mathcomp/field/closed_field.v ssreflect-1.15.0/mathcomp/field/closed_field.v --- ssreflect-1.14.0/mathcomp/field/closed_field.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/field/closed_field.v 2022-06-30 08:50:47.000000000 +0000 @@ -86,7 +86,7 @@ Definition qf_red_cps T (x : cps T) (y : _ -> T) := forall e k, qf_eval e (x k) = qf_eval e (k (y e)). Notation "x ->_ e y" := (qf_red_cps x (fun e => y)) - (e ident, at level 90, format "x ->_ e y"). + (e name, at level 90, format "x ->_ e y"). Definition qf_cps T D (x : cps T) := forall k, (forall y, D y -> qf (k y)) -> qf (x k). @@ -766,7 +766,7 @@ have [leMl leMr] := (leq_maxl, leq_maxr); pose le_max := (leq_max, leqnn, orbT). pose pairK (x y : Krep) (m := maxn _ _) := (toE _ m (leMl _ _) (tagged x), toE _ m (leMr _ _) (tagged y)). -pose eqKrep x y := prod_curry (@eq_op _) (pairK x y). +pose eqKrep x y := uncurry (@eq_op _) (pairK x y). have eqKrefl : reflexive eqKrep by move=> z; apply/eqP; apply: toEirr. have eqKsym : symmetric eqKrep. move=> z1 z2; rewrite {1}/eqKrep /= eq_sym; move: (leMl _ _) (leMr _ _). @@ -798,9 +798,9 @@ rewrite eqmodE /= /eqKrep; case: (repr _) => j y /= in lerm * => /eqP /=. have leijm: maxn i j <= m by rewrite geq_max leim. by move/(congr1 (toE _ _ leijm)); rewrite -!toEtrans. -pose Kadd (x y : K) := EtoK _ (prod_curry +%R (pairK (repr x) (repr y))). +pose Kadd (x y : K) := EtoK _ (uncurry +%R (pairK (repr x) (repr y))). pose Kopp (x : K) := EtoK _ (- tagged (repr x)). -pose Kmul (x y : K) := EtoK _ (prod_curry *%R (pairK (repr x) (repr y))). +pose Kmul (x y : K) := EtoK _ (uncurry *%R (pairK (repr x) (repr y))). pose Kinv (x : K) := EtoK _ (tagged (repr x))^-1. have EtoK_D i: {morph EtoK i : x y / x + y >-> Kadd x y}. move=> x y; apply: eqEtoK; set j := maxn (tag _) _; rewrite !rmorphD. diff -Nru ssreflect-1.14.0/mathcomp/field/cyclotomic.v ssreflect-1.15.0/mathcomp/field/cyclotomic.v --- ssreflect-1.14.0/mathcomp/field/cyclotomic.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/field/cyclotomic.v 2022-06-30 08:50:47.000000000 +0000 @@ -116,7 +116,7 @@ Local Notation pQtoC := (map_poly ratr). Local Definition algC_intr_inj := @intr_inj [numDomainType of algC]. -Local Hint Resolve algC_intr_inj : core. +#[local] Hint Resolve algC_intr_inj : core. Local Notation QtoC_M := (ratr_rmorphism [numFieldType of algC]). Lemma C_prim_root_exists n : (n > 0)%N -> {z : algC | n.-primitive_root z}. diff -Nru ssreflect-1.14.0/mathcomp/field/Make ssreflect-1.15.0/mathcomp/field/Make --- ssreflect-1.14.0/mathcomp/field/Make 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/field/Make 2022-06-30 08:50:47.000000000 +0000 @@ -18,5 +18,3 @@ -arg -w -arg +duplicate-clear -arg -w -arg -ambiguous-paths -arg -w -arg +undeclared-scope --arg -w -arg -deprecated-hint-without-locality --arg -w -arg -deprecated-ident-entry diff -Nru ssreflect-1.14.0/mathcomp/fingroup/action.v ssreflect-1.15.0/mathcomp/fingroup/action.v --- ssreflect-1.14.0/mathcomp/fingroup/action.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/fingroup/action.v 2022-06-30 08:50:47.000000000 +0000 @@ -267,7 +267,7 @@ (at level 0, format "[ 'acts' A , 'on' S | to ]") : form_scope. Notation "{ 'acts' A , 'on' S | to }" := (acts_on A S to) - (at level 0, format "{ 'acts' A , 'on' S | to }") : form_scope. + (at level 0, format "{ 'acts' A , 'on' S | to }") : type_scope. Notation "[ 'transitive' A , 'on' S | to ]" := (atrans A S to) (at level 0, format "[ 'transitive' A , 'on' S | to ]") : form_scope. @@ -1880,7 +1880,7 @@ (at level 8, format "''C_' ( G | to ) [ a ]") : group_scope. Notation "{ 'acts' A , 'on' 'group' G | to }" := (acts_on_group A G to) - (at level 0, format "{ 'acts' A , 'on' 'group' G | to }") : form_scope. + (at level 0, format "{ 'acts' A , 'on' 'group' G | to }") : type_scope. Section RawGroupAction. @@ -2728,8 +2728,3 @@ Arguments aut_groupAction {gT} G%g. Notation "[ 'Aut' G ]" := (aut_action G) : action_scope. Notation "[ 'Aut' G ]" := (aut_groupAction G) : groupAction_scope. - -#[deprecated(since="mathcomp 1.11.0", note="Use porbitE instead.")] -Notation pcycleE := porbitE (only parsing). -#[deprecated(since="mathcomp 1.11.0", note="Use porbit_actperm instead.")] -Notation pcycle_actperm := porbit_actperm (only parsing). diff -Nru ssreflect-1.14.0/mathcomp/fingroup/automorphism.v ssreflect-1.15.0/mathcomp/fingroup/automorphism.v --- ssreflect-1.14.0/mathcomp/fingroup/automorphism.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/fingroup/automorphism.v 2022-06-30 08:50:47.000000000 +0000 @@ -446,7 +446,7 @@ Arguments characteristic _ _%g _%g. Notation "H \char G" := (characteristic H G) : group_scope. -Hint Resolve char_refl : core. +#[global] Hint Resolve char_refl : core. Section InjmChar. diff -Nru ssreflect-1.14.0/mathcomp/fingroup/fingroup.v ssreflect-1.15.0/mathcomp/fingroup/fingroup.v --- ssreflect-1.14.0/mathcomp/fingroup/fingroup.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/fingroup/fingroup.v 2022-06-30 08:50:47.000000000 +0000 @@ -491,7 +491,7 @@ End PreGroupIdentities. -Hint Resolve commute1 : core. +#[global] Hint Resolve commute1 : core. Arguments invg_inj {T} [x1 x2]. Prenex Implicits commute invgK. @@ -1356,7 +1356,7 @@ (* Non-triviality. *) Lemma group1 : 1 \in G. Proof. by case/group_setP: (valP G). Qed. -Hint Resolve group1 : core. +#[local] Hint Resolve group1 : core. Lemma group1_contra x : x \notin G -> x != 1. Proof. by apply: contraNneq => ->. Qed. @@ -1626,7 +1626,7 @@ Lemma class_refl x : x \in x ^: G. Proof. by apply/imsetP; exists 1; rewrite ?conjg1. Qed. -Hint Resolve class_refl : core. +#[local] Hint Resolve class_refl : core. Lemma class_eqP x y : reflect (x ^: G = y ^: G) (x \in y ^: G). Proof. @@ -1773,7 +1773,7 @@ End OneGroup. -Hint Resolve group1 : core. +#[local] Hint Resolve group1 : core. Lemma groupD1_inj G H : G^# = H^# -> G :=: H. Proof. by move/(congr1 (setU 1)); rewrite !setD1K. Qed. @@ -1821,9 +1821,9 @@ End GroupProp. -Hint Extern 0 (is_true (1%g \in _)) => apply: group1 : core. -Hint Extern 0 (is_true (0 < #|_|)) => apply: cardG_gt0 : core. -Hint Extern 0 (is_true (0 < #|_ : _|)) => apply: indexg_gt0 : core. +#[global] Hint Extern 0 (is_true (1%g \in _)) => apply: group1 : core. +#[global] Hint Extern 0 (is_true (0 < #|_|)) => apply: cardG_gt0 : core. +#[global] Hint Extern 0 (is_true (0 < #|_ : _|)) => apply: indexg_gt0 : core. Notation "G :^ x" := (conjG_group G x) : Group_scope. @@ -1889,7 +1889,7 @@ End GroupInter. -Hint Resolve order_gt0 : core. +#[global] Hint Resolve order_gt0 : core. Arguments generated_group _ _%g. Arguments joing_group _ _%g _%g. @@ -2982,8 +2982,8 @@ Notation "''C_' ( G ) [ x ]" := (setI_group G 'C[x]) (only parsing) : Group_scope. -Hint Extern 0 (is_true (_ \subset _)) => apply: normG : core. -Hint Extern 0 (is_true (_ <| _)) => apply: normal_refl : core. +#[global] Hint Extern 0 (is_true (_ \subset _)) => apply: normG : core. +#[global] Hint Extern 0 (is_true (_ <| _)) => apply: normal_refl : core. Section MinMaxGroup. diff -Nru ssreflect-1.14.0/mathcomp/fingroup/gproduct.v ssreflect-1.15.0/mathcomp/fingroup/gproduct.v --- ssreflect-1.14.0/mathcomp/fingroup/gproduct.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/fingroup/gproduct.v 2022-06-30 08:50:47.000000000 +0000 @@ -100,9 +100,12 @@ Notation cprod := (central_product _). Notation dprod := (direct_product _). -Notation "G ><| H" := (sdprod G H)%g (at level 40, left associativity). -Notation "G \* H" := (cprod G H)%g (at level 40, left associativity). -Notation "G \x H" := (dprod G H)%g (at level 40, left associativity). +Notation "G ><| H" := (sdprod G H)%g + (at level 40, left associativity) : group_scope. +Notation "G \* H" := (cprod G H)%g + (at level 40, left associativity) : group_scope. +Notation "G \x H" := (dprod G H)%g + (at level 40, left associativity) : group_scope. Notation "[ 'complements' 'to' A 'in' B ]" := (complements_to_in A B) (at level 0, format "[ 'complements' 'to' A 'in' B ]") : group_scope. @@ -1672,7 +1675,7 @@ Variable gT : finGroupType. Implicit Types G H : {group gT}. -Definition mulgm : gT * gT -> _ := prod_curry mulg. +Definition mulgm : gT * gT -> _ := uncurry mulg. Lemma imset_mulgm (A B : {set gT}) : mulgm @: setX A B = A * B. Proof. by rewrite -curry_imset2X. Qed. diff -Nru ssreflect-1.14.0/mathcomp/fingroup/Make ssreflect-1.15.0/mathcomp/fingroup/Make --- ssreflect-1.14.0/mathcomp/fingroup/Make 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/fingroup/Make 2022-06-30 08:50:47.000000000 +0000 @@ -16,6 +16,4 @@ -arg -w -arg +duplicate-clear -arg -w -arg -ambiguous-paths -arg -w -arg +undeclared-scope --arg -w -arg -deprecated-hint-without-locality -arg -w -arg -deprecated-hint-rewrite-without-locality --arg -w -arg -deprecated-ident-entry diff -Nru ssreflect-1.14.0/mathcomp/fingroup/morphism.v ssreflect-1.15.0/mathcomp/fingroup/morphism.v --- ssreflect-1.14.0/mathcomp/fingroup/morphism.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/fingroup/morphism.v 2022-06-30 08:50:47.000000000 +0000 @@ -106,7 +106,7 @@ End MorphismStructure. Notation "{ 'morphism' D >-> T }" := (morphism_for D (Phant T)) - (at level 0, format "{ 'morphism' D >-> T }") : group_scope. + (at level 0, format "{ 'morphism' D >-> T }") : type_scope. Notation "[ 'morphism' D 'of' f ]" := (@clone_morphism _ _ D _ (fun fM => @Morphism _ _ D f fM)) (at level 0, format "[ 'morphism' D 'of' f ]") : form_scope. diff -Nru ssreflect-1.14.0/mathcomp/fingroup/perm.v ssreflect-1.15.0/mathcomp/fingroup/perm.v --- ssreflect-1.14.0/mathcomp/fingroup/perm.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/fingroup/perm.v 2022-06-30 08:50:47.000000000 +0000 @@ -709,28 +709,3 @@ Qed. End CastSn. - -#[deprecated(since="mathcomp 1.11.0", note="Use tuple_permP instead.")] -Notation tuple_perm_eqP := tuple_permP (only parsing). -#[deprecated(since="mathcomp 1.11.0", note="Use porbit instead.")] -Notation pcycle := porbit (only parsing). -#[deprecated(since="mathcomp 1.11.0", note="Use porbits instead.")] -Notation pcycles := porbits (only parsing). -#[deprecated(since="mathcomp 1.11.0", note="Use mem_porbit instead.")] -Notation mem_pcycle := mem_porbit (only parsing). -#[deprecated(since="mathcomp 1.11.0", note="Use porbit_id instead.")] -Notation pcycle_id := porbit_id (only parsing). -#[deprecated(since="mathcomp 1.11.0", note="Use uniq_traject_porbit instead.")] -Notation uniq_traject_pcycle := uniq_traject_porbit (only parsing). -#[deprecated(since="mathcomp 1.11.0", note="Use porbit_traject instead.")] -Notation pcycle_traject := porbit_traject (only parsing). -#[deprecated(since="mathcomp 1.11.0", note="Use iter_porbit instead.")] -Notation iter_pcycle := iter_porbit (only parsing). -#[deprecated(since="mathcomp 1.11.0", note="Use eq_porbit_mem instead.")] -Notation eq_pcycle_mem := eq_porbit_mem (only parsing). -#[deprecated(since="mathcomp 1.11.0", note="Use porbit_sym instead.")] -Notation pcycle_sym := porbit_sym (only parsing). -#[deprecated(since="mathcomp 1.11.0", note="Use porbit_perm instead.")] -Notation pcycle_perm := porbit_perm (only parsing). -#[deprecated(since="mathcomp 1.11.0", note="Use porbits_mul_tperm instead.")] -Notation ncycles_mul_tperm := porbits_mul_tperm (only parsing). diff -Nru ssreflect-1.14.0/mathcomp/Make ssreflect-1.15.0/mathcomp/Make --- ssreflect-1.14.0/mathcomp/Make 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/Make 2022-06-30 08:50:47.000000000 +0000 @@ -100,6 +100,4 @@ -arg -w -arg -ambiguous-paths -arg -w -arg +non-primitive-record -arg -w -arg +undeclared-scope --arg -w -arg -deprecated-hint-without-locality -arg -w -arg -deprecated-hint-rewrite-without-locality --arg -w -arg -deprecated-ident-entry diff -Nru ssreflect-1.14.0/mathcomp/Makefile.test-suite.coq.local ssreflect-1.15.0/mathcomp/Makefile.test-suite.coq.local --- ssreflect-1.14.0/mathcomp/Makefile.test-suite.coq.local 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/Makefile.test-suite.coq.local 2022-06-30 08:50:47.000000000 +0000 @@ -1,4 +1,4 @@ -OUTPUT_TESTS=test_suite/output.v test_suite/imset2_finset.v test_suite/imset2_gproduct.v +OUTPUT_TESTS=test_suite/output.v test_suite/imset2_finset.v test_suite/imset2_gproduct.v test_suite/test_rat.v OUTPUT_ARTIFACTS=$(OUTPUT_TESTS:%.v=%.v.out.new) diff -Nru ssreflect-1.14.0/mathcomp/Make.test-suite ssreflect-1.15.0/mathcomp/Make.test-suite --- ssreflect-1.14.0/mathcomp/Make.test-suite 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/Make.test-suite 2022-06-30 08:50:47.000000000 +0000 @@ -2,7 +2,6 @@ test_suite/test_ssrAC.v test_suite/test_guard.v test_suite/test_regular_conv.v -test_suite/test_rat.v -I . diff -Nru ssreflect-1.14.0/mathcomp/solvable/abelian.v ssreflect-1.15.0/mathcomp/solvable/abelian.v --- ssreflect-1.14.0/mathcomp/solvable/abelian.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/solvable/abelian.v 2022-06-30 08:50:47.000000000 +0000 @@ -773,7 +773,7 @@ Lemma p_rank_abelem p G : p.-abelem G -> 'r_p(G) = logn p #|G|. Proof. -move=> abelG; apply/eqP; rewrite eqn_leq andbC (bigmax_sup G) //. +move=> abelG; apply/eqP; rewrite eqn_leq andbC (bigmax_sup G)//. by apply/bigmax_leqP=> E /[1!inE] /andP[/lognSg->]. by rewrite inE subxx. Qed. @@ -881,7 +881,7 @@ Proof. move=> sAB; rewrite /rank !big_mkord; apply/bigmax_leqP=> p _. have leAB: #|A| < #|B|.+1 by rewrite ltnS subset_leq_card. -by rewrite (bigmax_sup (widen_ord leAB p)) // p_rankS. +by rewrite (bigmax_sup (widen_ord leAB p)) ?p_rankS. Qed. Lemma rank_geP n G : reflect (exists E, E \in 'E^n(G)) (n <= 'r(G)). @@ -1906,7 +1906,7 @@ rewrite (leq_trans (ltn_Pmull (prime_gt1 p_pr) _)) ?expn_gt0 ?prime_gt0 //. rewrite -expnS dvdn_leq // ?gcdn_gt0 ?order_gt0 // dvdn_gcd. rewrite pfactor_dvdn // dvdn_exp2l. - by rewrite -[xp in _ < xp]subn0 ltn_sub2l // lognE p_pr order_gt0 p_dv_x. + by rewrite -[ltnRHS]subn0 ltn_sub2l // lognE p_pr order_gt0 p_dv_x. rewrite ltn_sub2r // ltnNge -(dvdn_Pexp2l _ _ (prime_gt1 p_pr)) -!p_part. by rewrite !part_pnat_id // (pnat_dvd (exponent_dvdn G)). Qed. @@ -2066,7 +2066,7 @@ have [-> //|logx_gt0] := posnP (logn p #[x]). have lexpG: (logn p #[x]).-1 < logn p #|G|. by rewrite prednK // dvdn_leq_log ?order_dvdG. - by rewrite (@bigmax_sup _ (Ordinal lexpG)) ?(prednK, lti_lnO). + by rewrite (bigmax_sup (Ordinal lexpG)) ?(prednK, lti_lnO). rewrite /lnO -(count_logn_dprod_cycle _ _ defG). case: (ltnP e) (b_sorted p) => [lt_e_x | le_x_e]. rewrite -(cat_take_drop i.+1 b) -map_rev rev_cat !map_cat cat_path. diff -Nru ssreflect-1.14.0/mathcomp/solvable/extraspecial.v ssreflect-1.15.0/mathcomp/solvable/extraspecial.v --- ssreflect-1.14.0/mathcomp/solvable/extraspecial.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/solvable/extraspecial.v 2022-06-30 08:50:47.000000000 +0000 @@ -43,7 +43,7 @@ Unset Strict Implicit. Unset Printing Implicit Defensive. -Local Open Scope ring_scope. +Local Notation "n %:R" := (n %:R%R). Import GroupScope GRing.Theory. Reserved Notation "p ^{1+2}" (at level 2, format "p ^{1+2}"). @@ -59,7 +59,7 @@ Variable p : nat. -Definition act ij (k : 'Z_p) := let: (i, j) := ij in (i + k * j, j). +Definition act ij (k : 'Z_p) := let: (i, j) := ij in (i + k * j, j)%R. Lemma actP : is_action [set: 'Z_p] act. Proof. apply: is_total_action=> [] [i j] => [|k1 k2] /=; first by rewrite mul0r addr0. diff -Nru ssreflect-1.14.0/mathcomp/solvable/extremal.v ssreflect-1.15.0/mathcomp/solvable/extremal.v --- ssreflect-1.14.0/mathcomp/solvable/extremal.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/solvable/extremal.v 2022-06-30 08:50:47.000000000 +0000 @@ -50,7 +50,7 @@ Unset Strict Implicit. Unset Printing Implicit Defensive. -Local Open Scope ring_scope. +Local Notation "n %:R" := (n %:R%R). Import GroupScope GRing.Theory. Reserved Notation "''Mod_' m" (at level 8, m at level 2, format "''Mod_' m"). @@ -193,8 +193,8 @@ & {in A, {morph m : a / a^-1 >-> (a^-1)%R}}], [/\ abelian A, cyclic F, #|F| = p.-1 & [faithful F, on 'Ohm_1(G) | [Aut G]]] - & if n == 0%N then A = F else - exists t, [/\ t \in A, #[t] = 2, m t = - 1%R + & if n == 0 then A = F else + exists t, [/\ t \in A, #[t] = 2, m t = (- 1)%R & if odd p then [/\ cyclic A /\ cyclic P, exists s, [/\ s \in A, #[s] = (p ^ n)%N, m s = p.+1%:R & P = <[s]>] @@ -295,7 +295,7 @@ by rewrite Aut_prime_cyclic // -orderE ox1. exists m; split=> {im_m mV}//; have [n0 | n_gt0] := posnP n. by apply/eqP; rewrite eq_sym eqEcard pcore_sub oF oA n0 muln1 /=. -have [t At mt]: {t | t \in A & m t = -1}. +have [t At mt]: {t | t \in A & m t = -1}%R. apply: inv_m; rewrite /= Zp_cast // coprime_modr modn_small // subn1. by rewrite coprimenP // ltnW. have ot: #[t] = 2. @@ -625,7 +625,7 @@ apply: eq_existsb => [[x y]] /=; rewrite !xpair_eqE. congr (_ && _); apply: andb_id2l; move/eqP=> xq1; congr (_ && (_ == _)). by apply/eqP; rewrite eq_sym eq_invg_mul -expgS (ltn_predK q_gt1) xq1. -have unitrN1 : - 1 \in GRing.unit by move=> R; rewrite unitrN unitr1. +have unitrN1 : (- 1)%R \in GRing.unit by move=> R; rewrite unitrN unitr1. pose uN1 := FinRing.unit ('Z_#[Zp1 : 'Z_q]) (unitrN1 _). apply: Extremal.Grp => //; exists (Zp_unitm uN1). rewrite Aut_aut order_injm ?injm_Zp_unitm ?in_setT //; split=> //. @@ -932,7 +932,7 @@ Theorem dihedral2_structure : - n > 1 -> extremal_generators G 2 n (x, y) -> G \isog 'D_m -> + n > 1 -> extremal_generators G 2 n (x, y) -> G \isog 'D_m -> [/\ [/\ X ><| Y = G, {in G :\: X, forall t, #[t] = 2} & {in X & G :\: X, forall z t, z ^ t = z^-1}], [/\ G ^`(1) = <[x ^+ 2]>, 'Phi(G) = G ^`(1), #|G^`(1)| = r diff -Nru ssreflect-1.14.0/mathcomp/solvable/gseries.v ssreflect-1.15.0/mathcomp/solvable/gseries.v --- ssreflect-1.14.0/mathcomp/solvable/gseries.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/solvable/gseries.v 2022-06-30 08:50:47.000000000 +0000 @@ -95,7 +95,7 @@ Arguments group_rel_of {gT} r%group_rel_scope _%G _%G : extra scopes. -Notation "r .-series" := (path (rel_of_simpl_rel (group_rel_of r))) +Notation "r .-series" := (path (rel_of_simpl (group_rel_of r))) (at level 2, format "r .-series") : group_scope. Section Subnormal. diff -Nru ssreflect-1.14.0/mathcomp/solvable/Make ssreflect-1.15.0/mathcomp/solvable/Make --- ssreflect-1.14.0/mathcomp/solvable/Make 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/solvable/Make 2022-06-30 08:50:47.000000000 +0000 @@ -27,5 +27,3 @@ -arg -w -arg +duplicate-clear -arg -w -arg -ambiguous-paths -arg -w -arg +undeclared-scope --arg -w -arg -deprecated-hint-without-locality --arg -w -arg -deprecated-ident-entry diff -Nru ssreflect-1.14.0/mathcomp/ssreflect/bigop.v ssreflect-1.15.0/mathcomp/ssreflect/bigop.v --- ssreflect-1.14.0/mathcomp/ssreflect/bigop.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/ssreflect/bigop.v 2022-06-30 08:50:47.000000000 +0000 @@ -453,11 +453,6 @@ End Theory. -#[deprecated(since="mathcomp 1.12.0", note="Use mulmDl instead.")] -Notation mulm_addl := mulmDl (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use mulmDr instead.")] -Notation mulm_addr := mulmDr (only parsing). - End Theory. Include Theory. @@ -571,7 +566,7 @@ Lemma mem_index_enum T i : i \in index_enum T. Proof. by rewrite [index_enum T]unlock -enumT mem_enum. Qed. -Hint Resolve mem_index_enum : core. +#[global] Hint Resolve mem_index_enum : core. Lemma index_enum_uniq T : uniq (index_enum T). Proof. by rewrite [index_enum T]unlock -enumT enum_uniq. Qed. @@ -1368,6 +1363,17 @@ by rewrite big_cons IHr. Qed. +Lemma telescope_big (f : nat -> nat -> R) (n m : nat) : + (forall k, n < k < m -> op (f n k) (f k k.+1) = f n k.+1) -> + \big[op/idx]_(n <= i < m) f i i.+1 = if n < m then f n m else idx. +Proof. +elim: m => [//| m IHm]; first by rewrite ltn0 big_geq. +move=> tm; rewrite ltnS; case: ltnP=> // mn; first by rewrite big_geq. +rewrite big_nat_recr// IHm//; last first. + by move=> k /andP[nk /ltnW nm]; rewrite tm// nk. +by case: ltngtP mn=> //= [nm|<-]; rewrite ?mul1m// tm// nm leqnn. +Qed. + End Plain. Section Abelian. @@ -1771,6 +1777,56 @@ Arguments big_nat_recl [R idx op]. Arguments big_nat_recr [R idx op]. Arguments big_pmap [R idx op J I] h [r]. +Arguments telescope_big [R idx op] f [n m]. + +Section EqSupport. + +Variables (R : eqType) (idx : R). + +Section MonoidSupport. + +Variables (op : Monoid.law idx) (I : Type). + +Lemma eq_bigl_supp (r : seq I) (P1 : pred I) (P2 : pred I) (F : I -> R) : + {in [pred x | F x != idx], P1 =1 P2} -> + \big[op/idx]_(i <- r | P1 i) F i = \big[op/idx]_(i <- r | P2 i) F i. +Proof. +move=> P12; rewrite big_mkcond [RHS]big_mkcond; apply: eq_bigr => i _. +by case: (eqVneq (F i) idx) => [->|/P12->]; rewrite ?if_same. +Qed. + +End MonoidSupport. + +Section ComoidSupport. + +Variables (op : Monoid.com_law idx) (I : eqType). + +Lemma perm_big_supp_cond [r s : seq I] [P : pred I] (F : I -> R) : + perm_eq + [seq i <- r | P i && (F i != idx)] + [seq i <- s | P i && (F i != idx)] -> + \big[op/idx]_(i <- r | P i) F i = \big[op/idx]_(i <- s | P i) F i. +Proof. +move=> prs; rewrite !(bigID [pred i | F i == idx] P F)/=. +rewrite big1 ?Monoid.mul1m; last by move=> i /andP[_ /eqP->]. +rewrite [in RHS]big1 ?Monoid.mul1m; last by move=> i /andP[_ /eqP->]. +by rewrite -[in LHS]big_filter -[in RHS]big_filter; apply perm_big. +Qed. + +Lemma perm_big_supp [r s : seq I] [P : pred I] (F : I -> R) : + perm_eq [seq i <- r | F i != idx] [seq i <- s | F i != idx] -> + \big[op/idx]_(i <- r | P i) F i = \big[op/idx]_(i <- s | P i) F i. +Proof. +by move=> ?; apply: perm_big_supp_cond; rewrite !filter_predI perm_filter. +Qed. + +End ComoidSupport. + +End EqSupport. + +Arguments eq_bigl_supp [R idx op I r P1]. +Arguments perm_big_supp_cond [R idx op I r s P]. +Arguments perm_big_supp [R idx op I r s P]. Section Distributivity. @@ -1943,6 +1999,25 @@ End NatConst. +Lemma telescope_sumn_in n m f : n <= m -> + {in [pred i | n <= i <= m], {homo f : x y / x <= y}} -> + \sum_(n <= k < m) (f k.+1 - f k) = f m - f n. +Proof. +move=> nm fle; rewrite (telescope_big (fun i j => f j - f i)). + by case: ltngtP nm => // ->; rewrite subnn. +move=> k /andP[nk km] /=; rewrite addnBAC ?fle 1?ltnW// ?subnKC// ?fle// inE. +- by rewrite (ltnW nk) ltnW. +- by rewrite leqnn ltnW// (ltn_trans nk). +Qed. + +Lemma telescope_sumn n m f : {homo f : x y / x <= y} -> + \sum_(n <= k < m) (f k.+1 - f k) = f m - f n. +Proof. +move=> fle; case: (ltnP n m) => nm. +apply: (telescope_sumn_in (ltnW nm)) => ? ?; exact: fle. +by apply/esym/eqP; rewrite big_geq// subn_eq0 fle. +Qed. + Lemma sumnE r : sumn r = \sum_(i <- r) i. Proof. exact: foldrE. Qed. Lemma card_bseq n (T : finType) : #|{bseq n of T}| = \sum_(i < n.+1) #|T| ^ i. @@ -1974,6 +2049,11 @@ (\sum_(i | P i) E i == 0)%N = [forall (i | P i), E i == 0%N]. Proof. by rewrite eq_sym -(@leqif_sum I P _ (fun _ => 0%N) E) ?big1_eq. Qed. +Lemma leq_prod I r (P : pred I) (E1 E2 : I -> nat) : + (forall i, P i -> E1 i <= E2 i) -> + \prod_(i <- r | P i) E1 i <= \prod_(i <- r | P i) E2 i. +Proof. by move=> leE12; elim/big_ind2: _ => // m1 m2 n1 n2; apply: leq_mul. Qed. + Lemma prodn_cond_gt0 I r (P : pred I) F : (forall i, P i -> 0 < F i) -> 0 < \prod_(i <- r | P i) F i. Proof. by move=> Fpos; elim/big_ind: _ => // n1 n2; rewrite muln_gt0 => ->. Qed. @@ -1982,9 +2062,18 @@ (forall i, 0 < F i) -> 0 < \prod_(i <- r | P i) F i. Proof. by move=> Fpos; apply: prodn_cond_gt0. Qed. +Lemma leq_bigmax_seq (I : eqType) r (P : pred I) F i0 : + i0 \in r -> P i0 -> F i0 <= \max_(i <- r | P i) F i. +Proof. +move=> + Pi0; elim: r => // h t ih; rewrite inE big_cons. +move=> /predU1P[<-|i0t]; first by rewrite Pi0 leq_maxl. +by case: ifPn => Ph; [rewrite leq_max ih// orbT|rewrite ih]. +Qed. +Arguments leq_bigmax_seq [I r P F]. + Lemma leq_bigmax_cond (I : finType) (P : pred I) F i0 : P i0 -> F i0 <= \max_(i | P i) F i. -Proof. by move=> Pi0; rewrite (bigD1 i0) ?leq_maxl. Qed. +Proof. exact: leq_bigmax_seq. Qed. Arguments leq_bigmax_cond [I P F]. Lemma leq_bigmax (I : finType) F (i0 : I) : F i0 <= \max_i F i. @@ -1999,11 +2088,26 @@ by elim/big_ind: _ => // m1 m2; rewrite geq_max => ->. Qed. +Lemma bigmax_leqP_seq (I : eqType) r (P : pred I) m F : + reflect (forall i, i \in r -> P i -> F i <= m) (\max_(i <- r | P i) F i <= m). +Proof. +apply: (iffP idP) => leFm => [i ri Pi|]. + exact/(leq_trans _ leFm)/leq_bigmax_seq. +rewrite big_seq_cond; elim/big_ind: _ => // [m1 m2|i /andP[ri]]. + by rewrite geq_max => ->. +exact: leFm. +Qed. + Lemma bigmax_sup (I : finType) i0 (P : pred I) m F : P i0 -> m <= F i0 -> m <= \max_(i | P i) F i. Proof. by move=> Pi0 le_m_Fi0; apply: leq_trans (leq_bigmax_cond i0 Pi0). Qed. Arguments bigmax_sup [I] i0 [P m F]. +Lemma bigmax_sup_seq (I : eqType) r i0 (P : pred I) m F : + i0 \in r -> P i0 -> m <= F i0 -> m <= \max_(i <- r | P i) F i. +Proof. by move=> i0r Pi0 ?; apply: leq_trans (leq_bigmax_seq i0 _ _). Qed. +Arguments bigmax_sup_seq [I r] i0 [P m F]. + Lemma bigmax_eq_arg (I : finType) i0 (P : pred I) F : P i0 -> \max_(i | P i) F i = F [arg max_(i > i0 | P i) F i]. Proof. @@ -2054,7 +2158,5 @@ Proof. by move=> Pi0; apply: dvdn_trans; rewrite (bigD1 i0) ?dvdn_gcdl. Qed. Arguments biggcdn_inf [I] i0 [P F m]. -#[deprecated(since="mathcomp 1.12.0", note="Use big_enumP instead.")] -Notation filter_index_enum := deprecated_filter_index_enum (only parsing). #[deprecated(since="mathcomp 1.13.0", note="Use big_rmcond instead.")] Notation big_uncond := big_rmcond (only parsing). diff -Nru ssreflect-1.14.0/mathcomp/ssreflect/choice.v ssreflect-1.15.0/mathcomp/ssreflect/choice.v --- ssreflect-1.14.0/mathcomp/ssreflect/choice.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/ssreflect/choice.v 2022-06-30 08:50:47.000000000 +0000 @@ -276,6 +276,7 @@ Module Import Exports. Coercion base : class_of >-> Equality.class_of. +Coercion mixin : class_of >-> mixin_of. Coercion sort : type >-> Sortclass. Coercion eqType : type >-> Equality.type. Canonical eqType. diff -Nru ssreflect-1.14.0/mathcomp/ssreflect/div.v ssreflect-1.15.0/mathcomp/ssreflect/div.v --- ssreflect-1.14.0/mathcomp/ssreflect/div.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/ssreflect/div.v 2022-06-30 08:50:47.000000000 +0000 @@ -138,10 +138,10 @@ Proof. by rewrite ltn_mod. Qed. Lemma leq_trunc_div m d : m %/ d * d <= m. -Proof. by rewrite [m in _ <= m](divn_eq m d) leq_addr. Qed. +Proof. by rewrite [leqRHS](divn_eq m d) leq_addr. Qed. -Lemma leq_mod m d : m %% d <= m. -Proof. by rewrite [m in _ <= m](divn_eq m d) leq_addl. Qed. +Lemma leq_mod m d : m %% d <= m. +Proof. by rewrite [leqRHS](divn_eq m d) leq_addl. Qed. Lemma leq_div m d : m %/ d <= m. Proof. @@ -368,7 +368,7 @@ Lemma dvdn_mulr d m n : d %| m -> d %| m * n. Proof. by move=> d_m; rewrite mulnC dvdn_mull. Qed. -Hint Resolve dvdn0 dvd1n dvdnn dvdn_mull dvdn_mulr : core. +#[global] Hint Resolve dvdn0 dvd1n dvdnn dvdn_mull dvdn_mulr : core. Lemma dvdn_mul d1 d2 m1 m2 : d1 %| m1 -> d2 %| m2 -> d1 * d2 %| m1 * m2. Proof. @@ -504,7 +504,7 @@ have [/IHn/dvdn_mull->||-> _] // := ltngtP m n; exact: dvdn_mulr. Qed. -Hint Resolve dvdn_add dvdn_sub dvdn_exp : core. +#[global] Hint Resolve dvdn_add dvdn_sub dvdn_exp : core. Lemma eqn_mod_dvd d m n : n <= m -> (m == n %[mod d]) = (d %| m - n). Proof. @@ -613,7 +613,7 @@ rewrite gcdnE; case def_p: (_ %% _) => [|p]; first by rewrite /dvdn def_p. have lt_pm: p < m by rewrite -ltnS -def_p ltn_pmod. rewrite /= (divn_eq n.+1 m.+1) def_p dvdn_addr ?dvdn_mull //; last exact: IHm. -by rewrite gcdnE /= IHm // (ltn_trans (ltn_pmod _ _)). +by rewrite gcdnE /= IHm // (ltn_trans (ltn_pmod _ _)). Qed. Lemma dvdn_gcdl m n : gcdn m n %| m. @@ -1040,12 +1040,3 @@ Qed. End Chinese. - -#[deprecated(since="mathcomp 1.12.0", note="Use coprimeMl instead.")] -Notation coprime_mull := coprimeMl (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use coprimeMr instead.")] -Notation coprime_mulr := coprimeMr (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use coprimeXl instead.")] -Notation coprime_expl := coprimeXl (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use coprimeXr instead.")] -Notation coprime_expr := coprimeXr (only parsing). diff -Nru ssreflect-1.14.0/mathcomp/ssreflect/eqtype.v ssreflect-1.15.0/mathcomp/ssreflect/eqtype.v --- ssreflect-1.14.0/mathcomp/ssreflect/eqtype.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/ssreflect/eqtype.v 2022-06-30 08:50:47.000000000 +0000 @@ -38,6 +38,8 @@ (* x != y :> T <=> x and y compare unequal at type T. *) (* x =P y :: a proof of reflect (x = y) (x == y); x =P y coerces *) (* to x == y -> x = y. *) +(* eqbLHS := (X in (X == _))%pattern (for rewriting) *) +(* eqbRHS := (X in (_ == X))%pattern (for rewriting) *) (* eq_op == the boolean relation behind the == notation. *) (* pred1 a == the singleton predicate [pred x | x == a]. *) (* pred2, pred3, pred4 == pair, triple, quad predicates. *) @@ -189,6 +191,9 @@ Notation "x =P y :> T" := (eqP : reflect (x = y :> T) (x == y :> T)) (at level 70, y at next level, no associativity) : eq_scope. +Notation eqbLHS := (X in (X == _))%pattern. +Notation eqbRHS := (X in (_ == X))%pattern. + Prenex Implicits eq_op eqP. Lemma eq_refl (T : eqType) (x : T) : x == x. Proof. exact/eqP. Qed. @@ -197,7 +202,7 @@ Lemma eq_sym (T : eqType) (x y : T) : (x == y) = (y == x). Proof. exact/eqP/eqP. Qed. -Hint Resolve eq_refl eq_sym : core. +#[global] Hint Resolve eq_refl eq_sym : core. Variant eq_xor_neq (T : eqType) (x y : T) : bool -> bool -> Set := | EqNotNeq of x = y : eq_xor_neq x y true true @@ -477,7 +482,7 @@ Prenex Implicits frel. (* The coercion to rel must be explicit for derived Notations to unparse. *) -Notation coerced_frel f := (rel_of_simpl_rel (frel f)) (only parsing). +Notation coerced_frel f := (rel_of_simpl (frel f)) (only parsing). Section FunWith. @@ -504,12 +509,12 @@ Notation "[ 'fun' z : T => F 'with' d1 , .. , dn ]" := (SimplFunDelta (fun z : T => app_fdelta d1%FUN_DELTA .. (app_fdelta dn%FUN_DELTA (fun _ => F)) ..)) - (at level 0, z ident, only parsing) : fun_scope. + (at level 0, z name, only parsing) : fun_scope. Notation "[ 'fun' z => F 'with' d1 , .. , dn ]" := (SimplFunDelta (fun z => app_fdelta d1%FUN_DELTA .. (app_fdelta dn%FUN_DELTA (fun _ => F)) ..)) - (at level 0, z ident, format + (at level 0, z name, format "'[hv' [ '[' 'fun' z => '/ ' F ']' '/' 'with' '[' d1 , '/' .. , '/' dn ']' ] ']'" ) : fun_scope. diff -Nru ssreflect-1.14.0/mathcomp/ssreflect/finfun.v ssreflect-1.15.0/mathcomp/ssreflect/finfun.v --- ssreflect-1.14.0/mathcomp/ssreflect/finfun.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/ssreflect/finfun.v 2022-06-30 08:50:47.000000000 +0000 @@ -124,10 +124,10 @@ Arguments finfun {aT rT} g. Notation "[ 'ffun' x : aT => E ]" := (finfun (fun x : aT => E)) - (at level 0, x ident) : fun_scope. + (at level 0, x name) : fun_scope. Notation "[ 'ffun' x => E ]" := (@finfun _ (fun=> _) (fun x => E)) - (at level 0, x ident, format "[ 'ffun' x => E ]") : fun_scope. + (at level 0, x name, format "[ 'ffun' x => E ]") : fun_scope. Notation "[ 'ffun' => E ]" := [ffun _ => E] (at level 0, format "[ 'ffun' => E ]") : fun_scope. diff -Nru ssreflect-1.14.0/mathcomp/ssreflect/fingraph.v ssreflect-1.15.0/mathcomp/ssreflect/fingraph.v --- ssreflect-1.14.0/mathcomp/ssreflect/fingraph.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/ssreflect/fingraph.v 2022-06-30 08:50:47.000000000 +0000 @@ -223,7 +223,7 @@ End Connect. -Hint Resolve connect0 : core. +#[global] Hint Resolve connect0 : core. Notation n_comp e a := (n_comp_mem e (mem a)). Notation closed e a := (closed_mem e (mem a)). @@ -853,7 +853,7 @@ End Orbit. -Hint Resolve in_orbit mem_orbit order_gt0 orbit_uniq : core. +#[global] Hint Resolve in_orbit mem_orbit order_gt0 orbit_uniq : core. Prenex Implicits order orbit findex finv order_set. Arguments orbitPcycle {T f x}. diff -Nru ssreflect-1.14.0/mathcomp/ssreflect/finset.v ssreflect-1.15.0/mathcomp/ssreflect/finset.v --- ssreflect-1.14.0/mathcomp/ssreflect/finset.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/ssreflect/finset.v 2022-06-30 08:50:47.000000000 +0000 @@ -259,7 +259,7 @@ Arguments set0 {T}. Arguments eq_finset {T} [pA] pB eq_pAB. -Hint Resolve in_setT : core. +#[global] Hint Resolve in_setT : core. Notation "[ 'set' : T ]" := (setTfor (Phant T)) (at level 0, format "[ 'set' : T ]") : set_scope. @@ -1020,7 +1020,7 @@ Arguments subsetDP {T A B C}. Arguments subsetD1P {T A B x}. Prenex Implicits set1. -Hint Resolve subsetT_hint : core. +#[global] Hint Resolve subsetT_hint : core. Section setOpsAlgebra. @@ -1066,7 +1066,7 @@ (fun (aT rT : finType) f mD => [set y in @image_mem aT rT f mD]). Local Notation imset2_def := (fun (aT1 aT2 rT : finType) f (D1 : mem_pred aT1) (D2 : _ -> mem_pred aT2) => - [set y in @image_mem _ rT (prod_curry f) + [set y in @image_mem _ rT (uncurry f) (mem [pred u | D1 u.1 & D2 u.1 u.2])]). Module Type ImsetSig. @@ -1763,7 +1763,7 @@ Variables (A1 : {set aT1}) (A2 : {set aT2}). Variables (D1 : {pred aT1}) (D2 : {pred aT2}). -Lemma curry_imset2X : f @2: (A1, A2) = prod_curry f @: (setX A1 A2). +Lemma curry_imset2X : f @2: (A1, A2) = uncurry f @: (setX A1 A2). Proof. rewrite [@imset]unlock unlock; apply/setP=> x; rewrite !in_set; congr (x \in _). by apply: eq_image => u //=; rewrite !inE. diff -Nru ssreflect-1.14.0/mathcomp/ssreflect/fintype.v ssreflect-1.15.0/mathcomp/ssreflect/fintype.v --- ssreflect-1.14.0/mathcomp/ssreflect/fintype.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/ssreflect/fintype.v 2022-06-30 08:50:47.000000000 +0000 @@ -281,37 +281,37 @@ Definition pick (T : finType) (P : pred T) := ohead (enum P). Notation "[ 'pick' x | P ]" := (pick (fun x => P%B)) - (at level 0, x ident, format "[ 'pick' x | P ]") : form_scope. + (at level 0, x name, format "[ 'pick' x | P ]") : form_scope. Notation "[ 'pick' x : T | P ]" := (pick (fun x : T => P%B)) - (at level 0, x ident, only parsing) : form_scope. + (at level 0, x name, only parsing) : form_scope. Definition pick_true T (x : T) := true. Reserved Notation "[ 'pick' x : T ]" - (at level 0, x ident, format "[ 'pick' x : T ]"). + (at level 0, x name, format "[ 'pick' x : T ]"). Notation "[ 'pick' x : T ]" := [pick x : T | pick_true x] (only parsing) : form_scope. Notation "[ 'pick' x : T ]" := [pick x : T | pick_true _] (only printing) : form_scope. Notation "[ 'pick' x ]" := [pick x : _] - (at level 0, x ident, only parsing) : form_scope. + (at level 0, x name, only parsing) : form_scope. Notation "[ 'pick' x | P & Q ]" := [pick x | P && Q ] - (at level 0, x ident, + (at level 0, x name, format "[ '[hv ' 'pick' x | P '/ ' & Q ] ']'") : form_scope. Notation "[ 'pick' x : T | P & Q ]" := [pick x : T | P && Q ] - (at level 0, x ident, only parsing) : form_scope. + (at level 0, x name, only parsing) : form_scope. Notation "[ 'pick' x 'in' A ]" := [pick x | x \in A] - (at level 0, x ident, format "[ 'pick' x 'in' A ]") : form_scope. + (at level 0, x name, format "[ 'pick' x 'in' A ]") : form_scope. Notation "[ 'pick' x : T 'in' A ]" := [pick x : T | x \in A] - (at level 0, x ident, only parsing) : form_scope. + (at level 0, x name, only parsing) : form_scope. Notation "[ 'pick' x 'in' A | P ]" := [pick x | x \in A & P ] - (at level 0, x ident, + (at level 0, x name, format "[ '[hv ' 'pick' x 'in' A '/ ' | P ] ']'") : form_scope. Notation "[ 'pick' x : T 'in' A | P ]" := [pick x : T | x \in A & P ] - (at level 0, x ident, only parsing) : form_scope. + (at level 0, x name, only parsing) : form_scope. Notation "[ 'pick' x 'in' A | P & Q ]" := [pick x in A | P && Q] - (at level 0, x ident, format + (at level 0, x name, format "[ '[hv ' 'pick' x 'in' A '/ ' | P '/ ' & Q ] ']'") : form_scope. Notation "[ 'pick' x : T 'in' A | P & Q ]" := [pick x : T in A | P && Q] - (at level 0, x ident, only parsing) : form_scope. + (at level 0, x name, only parsing) : form_scope. (* We lock the definitions of card and subset to mitigate divergence of the *) (* Coq term comparison algorithm. *) @@ -362,8 +362,8 @@ End Definitions. -Notation "[ x | B ]" := (quant0b (fun x => B x)) (at level 0, x ident). -Notation "[ x : T | B ]" := (quant0b (fun x : T => B x)) (at level 0, x ident). +Notation "[ x | B ]" := (quant0b (fun x => B x)) (at level 0, x name). +Notation "[ x : T | B ]" := (quant0b (fun x : T => B x)) (at level 0, x name). Module Exports. @@ -916,10 +916,7 @@ End OpsTheory. -#[deprecated(since="mathcomp 1.12.0", note="Use disjointWl instead.")] -Notation disjoint_trans := disjointWl (only parsing). - -Hint Resolve subxx_hint : core. +#[global] Hint Resolve subxx_hint : core. Arguments pred0P {T P}. Arguments pred0Pn {T P}. @@ -1128,16 +1125,16 @@ Definition image_mem T T' f mA : seq T' := map f (@enum_mem T mA). Notation image f A := (image_mem f (mem A)). Notation "[ 'seq' F | x 'in' A ]" := (image (fun x => F) A) - (at level 0, F at level 99, x ident, + (at level 0, F at level 99, x name, format "'[hv' [ 'seq' F '/ ' | x 'in' A ] ']'") : seq_scope. Notation "[ 'seq' F | x : T 'in' A ]" := (image (fun x : T => F) A) - (at level 0, F at level 99, x ident, only parsing) : seq_scope. + (at level 0, F at level 99, x name, only parsing) : seq_scope. Notation "[ 'seq' F | x : T ]" := [seq F | x : T in pred_of_simpl (@pred_of_argType T)] - (at level 0, F at level 99, x ident, + (at level 0, F at level 99, x name, format "'[hv' [ 'seq' F '/ ' | x : T ] ']'") : seq_scope. Notation "[ 'seq' F , x ]" := [seq F | x : _ ] - (at level 0, F at level 99, x ident, only parsing) : seq_scope. + (at level 0, F at level 99, x name, only parsing) : seq_scope. Definition codom T T' f := @image_mem T T' f (mem T). @@ -1725,11 +1722,6 @@ End Extrema. -#[deprecated(since="mathcomp 1.11.0", note="Use arg_minnP instead.")] -Notation arg_minP := arg_minnP (only parsing). -#[deprecated(since="mathcomp 1.11.0", note="Use arg_maxnP instead.")] -Notation arg_maxP := arg_maxnP (only parsing). - Notation "[ 'arg' 'min_' ( i < i0 | P ) F ]" := (arg_min i0 (fun i => P%B) (fun i => F)) (at level 0, i, i0 at level 10, @@ -1810,7 +1802,7 @@ Notation "''I_' n" := (ordinal n) (at level 8, n at level 2, format "''I_' n"). -Hint Resolve ltn_ord : core. +#[global] Hint Resolve ltn_ord : core. Section OrdinalEnum. @@ -1847,6 +1839,9 @@ End OrdinalEnum. +Lemma enum_ord0 : enum 'I_0 = [::]. +Proof. by apply/eqP; rewrite -size_eq0 size_enum_ord. Qed. + Lemma widen_ord_proof n m (i : 'I_n) : n <= m -> i < m. Proof. exact: leq_trans. Qed. Definition widen_ord n m le_n_m i := Ordinal (@widen_ord_proof n m i le_n_m). @@ -2241,12 +2236,20 @@ Lemma inord_val (i : 'I_n) : inord i = i. Proof. by rewrite /inord /insubd valK. Qed. -Lemma enum_ordS : enum 'I_n = ord0 :: map (lift ord0) (enum 'I_n'). +Lemma enum_ordSl : enum 'I_n = ord0 :: map (lift ord0) (enum 'I_n'). Proof. apply: (inj_map val_inj); rewrite val_enum_ord /= -map_comp. by rewrite (map_comp (addn 1)) val_enum_ord -iotaDl. Qed. +Lemma enum_ordSr : + enum 'I_n = rcons (map (widen_ord (leqnSn _)) (enum 'I_n')) ord_max. +Proof. +apply: (inj_map val_inj); rewrite val_enum_ord. +rewrite -[in iota _ _]addn1 iotaD/= cats1 map_rcons; congr (rcons _ _). +by rewrite -map_comp/= (@eq_map _ _ _ val) ?val_enum_ord. +Qed. + Lemma lift_max (i : 'I_n') : lift ord_max i = i :> nat. Proof. by rewrite /= /bump leqNgt ltn_ord. Qed. @@ -2261,6 +2264,9 @@ Arguments sub_ordK {n'}. Arguments inord_val {n'}. +#[deprecated(since="mathcomp 1.15.0", note="Use enum_ordSl instead.")] +Notation enum_ordS := enum_ordSl. + Lemma ord1 : all_equal_to (ord0 : 'I_1). Proof. by case=> [[] // ?]; apply: val_inj. Qed. @@ -2351,8 +2357,3 @@ Proof. by rewrite !cardT !enumT [in LHS]unlock size_cat !size_map. Qed. End SumFinType. - -#[deprecated(since="mathcomp 1.12.0", note="Use bumpDl instead.")] -Notation bump_addl := bumpDl (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use unbumpDl instead.")] -Notation unbump_addl := unbumpDl (only parsing). diff -Nru ssreflect-1.14.0/mathcomp/ssreflect/generic_quotient.v ssreflect-1.15.0/mathcomp/ssreflect/generic_quotient.v --- ssreflect-1.14.0/mathcomp/ssreflect/generic_quotient.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/ssreflect/generic_quotient.v 2022-06-30 08:50:47.000000000 +0000 @@ -7,7 +7,7 @@ (* Provided a base type T, this files defines an interface for quotients Q *) (* of the type T with explicit functions for canonical surjection (\pi *) (* : T -> Q) and for choosing a representative (repr : Q -> T). It then *) -(* provide a helper to quotient T by a decidable equivalence relation (e *) +(* provides a helper to quotient T by a decidable equivalence relation (e *) (* : rel T) if T is a choiceType (or encodable as a choiceType modulo e). *) (* *) (* See "Pragmatic Quotient Types in Coq", proceedings of ITP2013, *) @@ -138,7 +138,7 @@ Lemma repr_ofK : cancel repr_of \pi. Proof. by rewrite /pi_phant /repr_of /=; case: qT=> [? []]. Qed. -Definition QuotType_clone (Q : Type) qT cT +Definition QuotType_clone (Q : Type) qT cT of phant_id (quot_class qT) cT := @QuotTypePack Q cT. End QuotientDef. @@ -298,7 +298,7 @@ (* lifting helpers *) Notation lift_op1 Q f := (locked (fun x : Q => \pi_Q (f (repr x)) : Q)). -Notation lift_op2 Q g := +Notation lift_op2 Q g := (locked (fun x y : Q => \pi_Q (g (repr x) (repr y)) : Q)). Notation lift_fun1 Q f := (locked (fun x : Q => f (repr x))). Notation lift_fun2 Q g := (locked (fun x y : Q => g (repr x) (repr y))). @@ -315,7 +315,7 @@ Proof. by rewrite -lock. Qed. Prenex Implicits eq_lock. -Notation PiEmbed e := +Notation PiEmbed e := (fun x => @EqualTo _ _ (e x) (eq_lock (fun _ => \pi _) _)). (********************) @@ -340,8 +340,7 @@ Record eqQuotType : Type := EqQuotTypePack { eq_quot_sort :> Type; - _ : eq_quot_class_of eq_quot_sort; - + _ : eq_quot_class_of eq_quot_sort }. Implicit Type eqT : eqQuotType. @@ -356,11 +355,11 @@ Coercion eqQuotType_quotType : eqQuotType >-> quotType. Definition EqQuotType_pack Q := - fun (qT : quotType T) (eT : eqType) qc ec - of phant_id (quot_class qT) qc & phant_id (Equality.class eT) ec => + fun (qT : quotType T) (eT : eqType) qc ec + of phant_id (quot_class qT) qc & phant_id (Equality.class eT) ec => fun m => EqQuotTypePack (@EqQuotClass Q qc ec m). -Definition EqQuotType_clone (Q : Type) eqT cT +Definition EqQuotType_clone (Q : Type) eqT cT of phant_id (eq_quot_class eqT) cT := @EqQuotTypePack Q cT. Lemma pi_eq_quot eqT : {mono \pi_eqT : x y / eq_quot_op x y >-> x == y}. @@ -431,19 +430,19 @@ (@SubType T _ Q _ _ (@QuotSubType.reprP _ _) (@QuotSubType.qreprK _ _)) (at level 0, format "[ 'subType' Q 'of' T 'by' %/ ]") : form_scope. -Notation "[ 'eqMixin' 'of' Q 'by' <:%/ ]" := +Notation "[ 'eqMixin' 'of' Q 'by' <:%/ ]" := (@QuotSubType.eqMixin _ _: Equality.class_of Q) (at level 0, format "[ 'eqMixin' 'of' Q 'by' <:%/ ]") : form_scope. -Notation "[ 'choiceMixin' 'of' Q 'by' <:%/ ]" := +Notation "[ 'choiceMixin' 'of' Q 'by' <:%/ ]" := (@QuotSubType.choiceMixin _ _: Choice.mixin_of Q) (at level 0, format "[ 'choiceMixin' 'of' Q 'by' <:%/ ]") : form_scope. -Notation "[ 'countMixin' 'of' Q 'by' <:%/ ]" := +Notation "[ 'countMixin' 'of' Q 'by' <:%/ ]" := (@QuotSubType.countMixin _ _: Countable.mixin_of Q) (at level 0, format "[ 'countMixin' 'of' Q 'by' <:%/ ]") : form_scope. -Notation "[ 'finMixin' 'of' Q 'by' <:%/ ]" := +Notation "[ 'finMixin' 'of' Q 'by' <:%/ ]" := (@QuotSubType.finMixin _ _: Finite.mixin_of Q) (at level 0, format "[ 'finMixin' 'of' Q 'by' <:%/ ]") : form_scope. @@ -494,7 +493,7 @@ End EquivRel. -Hint Resolve equiv_refl : core. +#[global] Hint Resolve equiv_refl : core. Notation EquivRel r er es et := (@EquivRelPack _ r (EquivClass er es et)). Notation "[ 'equiv_rel' 'of' e ]" := (@equiv_pack _ _ e _ id) @@ -518,7 +517,7 @@ Variable r : encModRel. -Definition encModRelClass := +Definition encModRelClass := let: EncModRelPack _ c as r' := r return encModRel_class_of r' in c. Definition encModRelP (x : D) : r x x -> r (ED (DE x)) x. diff -Nru ssreflect-1.14.0/mathcomp/ssreflect/Make ssreflect-1.15.0/mathcomp/ssreflect/Make --- ssreflect-1.14.0/mathcomp/ssreflect/Make 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/ssreflect/Make 2022-06-30 08:50:47.000000000 +0000 @@ -32,5 +32,3 @@ -arg -w -arg -ambiguous-paths -arg -w -arg +undeclared-scope -arg -w -arg -non-reversible-notation --arg -w -arg -deprecated-hint-without-locality --arg -w -arg -deprecated-ident-entry diff -Nru ssreflect-1.14.0/mathcomp/ssreflect/order.v ssreflect-1.15.0/mathcomp/ssreflect/order.v --- ssreflect-1.14.0/mathcomp/ssreflect/order.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/ssreflect/order.v 2022-06-30 08:50:47.000000000 +0000 @@ -84,6 +84,10 @@ (* x < y ?<= if C <-> x is smaller than y, and strictly if C is false. *) (* x >=< y <-> x and y are comparable (:= (x <= y) || (y <= x)). *) (* x >< y <-> x and y are incomparable (:= ~~ x >=< y). *) +(* f \min g <-> the function x |-> Order.min (f x) (g x); *) +(* f \min g simplifies on application. *) +(* f \max g <-> the function x |-> Order.max (f x) (g x); *) +(* f \max g simplifies on application. *) (* For x, y of type T, where T is canonically a latticeType d: *) (* x `&` y == the meet of x and y. *) (* x `|` y == the join of x and y. *) @@ -215,6 +219,12 @@ (* with head symbols Order.arg_min and Order.arg_max *) (* The user may use extremumP or extremum_inP to eliminate them. *) (* *) +(* -> patterns for contextual rewriting: *) +(* leLHS := (X in (X <= _)%O)%pattern *) +(* leRHS := (X in (_ <= X)%O)%pattern *) +(* ltLHS := (X in (X < _)%O)%pattern *) +(* ltRHS := (X in (_ < X)%O)%pattern *) +(* *) (* In order to build the above structures, one must provide the appropriate *) (* factory instance to the following structure constructors. The list of *) (* possible factories is indicated after each constructor. Each factory is *) @@ -460,6 +470,8 @@ Reserved Notation "x >< y" (at level 70, no associativity). Reserved Notation ">< x" (at level 35). Reserved Notation ">< y :> T" (at level 35, y at next level). +Reserved Notation "f \min g" (at level 50, left associativity). +Reserved Notation "f \max g" (at level 50, left associativity). Reserved Notation "x < y ?<= 'if' c" (at level 70, y, c at next level, format "x '[hv' < y '/' ?<= 'if' c ']'"). @@ -1151,6 +1163,14 @@ Definition arg_min {I : finType} := @extremum T I le. Definition arg_max {I : finType} := @extremum T I ge. +(* Lifted min/max operations. *) +Section LiftedPOrder. +Variable T' : Type. +Implicit Type f : T' -> T. +Definition min_fun f g x := min (f x) (g x). +Definition max_fun f g x := min (f x) (g x). +End LiftedPOrder. + End POrderDef. Prenex Implicits lt le leif lteif. @@ -1159,6 +1179,8 @@ Arguments min {_ _}. Arguments max {_ _}. Arguments comparable {_ _}. +Arguments min_fun {_ _ _} f g _ /. +Arguments max_fun {_ _ _} f g _ /. Module Import POSyntax. @@ -1240,6 +1262,14 @@ (at level 0, i, i0 at level 10, format "[ 'arg' 'max_' ( i > i0 ) F ]") : order_scope. +Notation "f \min g" := (min_fun f g) : order_scope. +Notation "f \max g" := (max_fun f g) : order_scope. + +Notation leLHS := (X in (X <= _)%O)%pattern. +Notation leRHS := (X in (_ <= X)%O)%pattern. +Notation ltLHS := (X in (X < _)%O)%pattern. +Notation ltRHS := (X in (_ < X)%O)%pattern. + End POSyntax. Module POCoercions. @@ -1634,7 +1664,7 @@ Notation "[ 'distrLatticeType' 'of' T ]" := [distrLatticeType of T for _] (at level 0, format "[ 'distrLatticeType' 'of' T ]") : form_scope. Notation "[ 'distrLatticeType' 'of' T 'with' disp ]" := - [latticeType of T for _ with disp] + [distrLatticeType of T for _ with disp] (at level 0, format "[ 'distrLatticeType' 'of' T 'with' disp ]") : form_scope. End Exports. @@ -2702,6 +2732,9 @@ Lemma ge_trans: transitive (>=%O : rel T). Proof. by move=> ? ? ? ? /le_trans; apply. Qed. +Lemma le_le_trans x y z t : z <= x -> y <= t -> x <= y -> z <= t. +Proof. by move=> + /(le_trans _)/[apply]; apply: le_trans. Qed. + Lemma lt_def x y: (x < y) = (y != x) && (x <= y). Proof. by case: T x y => ? [? []]. Qed. @@ -3436,8 +3469,8 @@ Proof. by move=> *; elim/big_ind : _. Qed. End POrderTheory. -Hint Resolve comparable_minr comparable_minl : core. -Hint Resolve comparable_maxr comparable_maxl : core. +#[global] Hint Resolve comparable_minr comparable_minl : core. +#[global] Hint Resolve comparable_maxr comparable_maxl : core. Section ContraTheory. Context {disp1 disp2 : unit} {T1 : porderType disp1} {T2 : porderType disp2}. @@ -3622,7 +3655,7 @@ End POrderTheory. -Hint Resolve lexx le_refl ltxx lt_irreflexive ltW lt_eqF : core. +#[global] Hint Resolve lexx le_refl ltxx lt_irreflexive ltW lt_eqF : core. Arguments leifP {disp T x y C}. Arguments leif_refl {disp T x C}. @@ -4158,10 +4191,10 @@ End TotalTheory. -Hint Resolve le_total : core. -Hint Resolve ge_total : core. -Hint Resolve comparableT : core. -Hint Resolve sort_le_sorted : core. +#[global] Hint Resolve le_total : core. +#[global] Hint Resolve ge_total : core. +#[global] Hint Resolve comparableT : core. +#[global] Hint Resolve sort_le_sorted : core. Arguments min_idPr {disp T x y}. Arguments max_idPl {disp T x y}. @@ -7978,9 +8011,9 @@ Module Exports. Notation "{ 'subset' [ d ] T }" := (type_of d (Phant T)) - (at level 2, d at next level, format "{ 'subset' [ d ] T }") : order_scope. + (at level 2, d at next level, format "{ 'subset' [ d ] T }") : type_scope. Notation "{ 'subset' T }" := {subset[subset_display] T} - (at level 2, format "{ 'subset' T }") : order_scope. + (at level 2, format "{ 'subset' T }") : type_scope. Canonical eqType. Canonical choiceType. @@ -8477,7 +8510,7 @@ pose sum p := \sum_(i < n | (i < tag p)%N) p_ i + tagged p. rewrite -/(sum _); have sumlt : forall p, (sum p < \sum_i p_ i)%N. rewrite /sum => -[/= i j]. - rewrite [X in (_ < X)%N](bigID [pred i' : 'I__ | (i' < i)%N])/= ltn_add2l. + rewrite [ltnRHS](bigID [pred i' : 'I__ | (i' < i)%N])/= ltn_add2l. by rewrite (bigD1 i) ?ltnn//= ltn_addr. suff: rank =1 (fun p => Ordinal (sumlt p)) by move=> /(_ p)/(congr1 val). apply: (Order.mono_unique _ _ le_rank) => //=. @@ -8488,10 +8521,10 @@ by rewrite -ii' in j' *; rewrite tagged_asE => ltjj'; rewrite ltn_add2l. rewrite ltn_addr// (@leq_trans (\sum_(i0 < n | (i0 < i)%N) p_ i0 + p_ i))%N//. by rewrite ltn_add2l. -rewrite [X in (_ <= X)%N](bigID [pred i' : 'I__ | (i' < i)%N])/=. +rewrite [leqRHS](bigID [pred i' : 'I__ | (i' < i)%N])/=. rewrite leq_add//; last first. by rewrite (bigD1 i) ?ltnn ?ltii'//= leq_addr. -rewrite [X in (_ <= X)%N](eq_bigl [pred k : 'I_n | (k < i)%N])// => k/=. +rewrite [leqRHS](eq_bigl [pred k : 'I_n | (k < i)%N])// => k/=. by case: (ltnP k i); rewrite ?andbF// => /ltn_trans->. Qed. diff -Nru ssreflect-1.14.0/mathcomp/ssreflect/path.v ssreflect-1.15.0/mathcomp/ssreflect/path.v --- ssreflect-1.14.0/mathcomp/ssreflect/path.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/ssreflect/path.v 2022-06-30 08:50:47.000000000 +0000 @@ -20,8 +20,8 @@ (* We define notations for the common cases of function paths, where the *) (* progress relation is actually a function. In detail: *) (* path e x p == x :: p is an e-path [:: x_0; x_1; ... ; x_n], i.e., we *) -(* e x_i x_{i+1} for all i < n. The path x :: p starts at x *) -(* and ends at last x p. *) +(* have e x_i x_{i+1} for all i < n. The path x :: p starts *) +(* at x and ends at last x p. *) (* fpath f x p == x :: p is an f-path, where f is a function, i.e., p is of *) (* the form [:: f x; f (f x); ...]. This is just a notation *) (* for path (frel f) x p. *) @@ -143,6 +143,10 @@ Definition sorted s := if s is x :: s' then path x s' else true. +Lemma sortedP s x : + reflect (forall i, i.+1 < size s -> e (nth x s i) (nth x s i.+1)) (sorted s). +Proof. by case: s => *; [constructor|apply: (iffP (pathP _ _ _)); apply]. Qed. + Lemma path_sorted x s : path x s -> sorted s. Proof. by case: s => //= y s /andP[]. Qed. @@ -377,6 +381,7 @@ End Paths. Arguments pathP {T e x p}. +Arguments sortedP {T e s}. Arguments path_sorted {T e x s}. Arguments path_min_sorted {T e x s}. Arguments order_path_min_in {T P leT x s}. @@ -1748,16 +1753,6 @@ Prenex Implicits arc. -#[deprecated(since="mathcomp 1.12.0", note="Use sorted_ltn_nth instead.")] -Notation sorted_lt_nth := sorted_ltn_nth (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use sorted_leq_nth instead.")] -Notation sorted_le_nth := sorted_leq_nth (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use sorted_ltn_index instead.")] -Notation ltn_index := sorted_ltn_index (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use sorted_leq_index instead.")] -Notation leq_index := sorted_leq_index (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use subseq_path instead.")] -Notation subseq_order_path := subseq_path (only parsing). #[deprecated(since="mathcomp 1.13.0", note="Use sub_in_path instead.")] Notation sub_path_in := sub_in_path (only parsing). #[deprecated(since="mathcomp 1.13.0", note="Use sub_in_cycle instead.")] diff -Nru ssreflect-1.14.0/mathcomp/ssreflect/prime.v ssreflect-1.15.0/mathcomp/ssreflect/prime.v --- ssreflect-1.14.0/mathcomp/ssreflect/prime.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/ssreflect/prime.v 2022-06-30 08:50:47.000000000 +0000 @@ -165,7 +165,7 @@ Notation "\pi ( n )" := (pi_of n) (at level 2, format "\pi ( n )") : nat_scope. -Notation "\p 'i' ( A )" := \pi(#|A|) +Notation "\p 'i' ( A )" := \pi(#|A|) (at level 2, format "\p 'i' ( A )") : nat_scope. Definition pdiv n := head 1 (primes n). @@ -301,7 +301,7 @@ rewrite orbT next_pm /= -(leq_add2r d.*2) def_m 2!addSnnS -doubleS leq_add. - move: ltc; rewrite /kb {}/bc andbT; case e => //= e' _; case: ifnzP => //. by case: edivn2P. - - by rewrite -[p in p < _]muln1 ltn_pmul2l. + - by rewrite -[ltnLHS]muln1 ltn_pmul2l. by rewrite leq_double def_a mulSn (leq_trans ltdp) ?leq_addr. rewrite mulnDl !muln2 -addnA addnCA doubleD addnCA. rewrite (_ : _ + bc.2 = d); last first. @@ -322,14 +322,14 @@ rewrite {1}/pfactor 2!expnS -!mulnA /=. case: (_ ^ _ * _) => [|u -> _ /andP[lt1q _]]; first by rewrite !muln0. left; right; exists q; last by rewrite dvdn_mulr. - have lt0q := ltnW lt1q; rewrite lt1q -[q in q < _]muln1 ltn_pmul2l //. + have lt0q := ltnW lt1q; rewrite lt1q -[ltnLHS]muln1 ltn_pmul2l //. by rewrite -[2]muln1 leq_mul. rewrite {1}/pfactor expn1; case: pd => [|[r e] pd] /=; last first. case: e => [|e] /=; first by rewrite !andbF. rewrite {1}/pfactor expnS -mulnA. case: (_ ^ _ * _) => [|u -> _ /and3P[lt1q ltqr _]]; first by rewrite !muln0. left; right; exists q; last by rewrite dvdn_mulr. - by rewrite lt1q -[q in q < _]mul1n ltn_mul // -[q.+1]muln1 leq_mul. + by rewrite lt1q -[ltnLHS]mul1n ltn_mul // -[q.+1]muln1 leq_mul. rewrite muln1 !andbT => def_q pr_q lt1q; right=> [[]] // [d]. by rewrite def_q -mem_index_iota => in_d_2q dv_d_q; case/hasP: pr_q; exists d. Qed. @@ -362,7 +362,7 @@ Lemma prime_gt0 p : prime p -> 0 < p. Proof. by move/prime_gt1; apply: ltnW. Qed. -Hint Resolve prime_gt1 prime_gt0 : core. +#[global] Hint Resolve prime_gt1 prime_gt0 : core. Lemma prod_prime_decomp n : n > 0 -> n = \prod_(f <- prime_decomp n) f.1 ^ f.2. @@ -423,7 +423,7 @@ Qed. Lemma Euclid_dvd_prod (I : Type) (r : seq I) (P : pred I) (f : I -> nat) p : - prime p -> + prime p -> p %| \prod_(i <- r | P i) f i = \big[orb/false]_(i <- r | P i) (p %| f i). Proof. move=> pP; apply: big_morph=> [x y|]; [exact: Euclid_dvdM | exact: Euclid_dvd1]. @@ -503,7 +503,7 @@ Lemma max_pdiv_gt0 n : 0 < max_pdiv n. Proof. by case: n => [|[|n]] //; rewrite prime_gt0 ?max_pdiv_prime. Qed. -Hint Resolve pdiv_gt0 max_pdiv_gt0 : core. +#[global] Hint Resolve pdiv_gt0 max_pdiv_gt0 : core. Lemma pdiv_min_dvd m d : 1 < d -> d %| m -> pdiv m <= d. Proof. @@ -530,8 +530,8 @@ suffices ->: n = pdiv n by rewrite pdiv_prime ?def_n. apply/eqP; rewrite eqn_leq leqNgt andbC pdiv_leq; last by rewrite def_n. apply/contraL: lt_n_p2 => lt_pm_m; case/dvdnP: (pdiv_dvd n) => q def_q. -rewrite -leqNgt [n in _ <= n]def_q leq_pmul2r // pdiv_min_dvd //. - by rewrite -[pdiv n]mul1n [n in _ < n]def_q ltn_pmul2r in lt_pm_m. +rewrite -leqNgt [leqRHS]def_q leq_pmul2r // pdiv_min_dvd //. + by rewrite -[pdiv n]mul1n [ltnRHS]def_q ltn_pmul2r in lt_pm_m. by rewrite def_q dvdn_mulr. Qed. @@ -541,7 +541,7 @@ apply: (iffP idP) => [npr_p|]; last first. case=> [|[p [pr_p le_p2_n dv_p_n]]]; first by case: n => [|[]]. apply/negP=> pr_n; move: dv_p_n le_p2_n; rewrite dvdn_prime2 //; move/eqP->. - by rewrite leqNgt -[n in n < _]muln1 ltn_pmul2l ?prime_gt1 ?prime_gt0. + by rewrite leqNgt -[ltnLHS]muln1 ltn_pmul2l ?prime_gt1 ?prime_gt0. have [lt1p|] := leqP; [right | by left]. exists (pdiv n); rewrite pdiv_dvd pdiv_prime //; split=> //. by case: leqP npr_p => // /ltn_pdiv2_prime -> //; exact: ltnW. @@ -643,7 +643,7 @@ Lemma pfactor_gt0 p n : 0 < p ^ logn p n. Proof. by rewrite expn_gt0 lognE; case: (posnP p) => // ->. Qed. -Hint Resolve pfactor_gt0 : core. +#[global] Hint Resolve pfactor_gt0 : core. Lemma pfactor_dvdn p n m : prime p -> m > 0 -> (p ^ n %| m) = (n <= logn p m). Proof. @@ -842,7 +842,7 @@ apply/idP/idP => [/eqP sk0 | nlep]; first by move: b2; rewrite sk0. symmetry; rewrite -[_ == _]/false /is_true -b1; apply/negbTE; rewrite -ltnNge. move: nlep; rewrite -ltnS => nlep; apply: (leq_ltn_trans nlep). -by rewrite -[X in X <= _]expn1; apply: leq_pexp2l. +by rewrite -[leqLHS]expn1; apply: leq_pexp2l. Qed. Lemma trunc_log_gt0 p n : (0 < trunc_log p n) = (1 < p) && (p.-1 < n). @@ -901,7 +901,7 @@ (* Truncated up real logarithm *) Definition up_log p n := - if (p <= 1) then 0 else + if (p <= 1) then 0 else let v := trunc_log p n in if n <= p ^ v then v else v.+1. Lemma up_log0 p : up_log p 0 = 0. @@ -969,9 +969,9 @@ Proof. by move=> p_gt1; apply: up_log_eq; rewrite p_gt1 /=. Qed. Lemma up_expnK p n : 1 < p -> up_log p (p ^ n) = n. -Proof. +Proof. case: n => [|n] p_gt1 /=; first by rewrite up_log1. -by apply: up_log_eq; rewrite // leqnn andbT ltn_exp2l. +by apply: up_log_eq; rewrite // leqnn andbT ltn_exp2l. Qed. Lemma up_logMp p n : 1 < p -> 0 < n -> up_log p (p * n) = (up_log p n).+1. @@ -992,7 +992,7 @@ case: n=> // [] [|n] // _. apply: up_log_eq => //; apply/andP; split. apply: leq_trans (_ : n./2.+1.*2 < n.+3); last first. - by rewrite doubleS !ltnS -[X in _ <= X]odd_double_half leq_addl. + by rewrite doubleS !ltnS -[leqRHS]odd_double_half leq_addl. have /= /andP[H1n _] := up_log_bounds (isT : 1 < 2) (isT : 1 < n./2.+2). by rewrite ltnS -leq_double -mul2n -expnS prednK ?up_log_gt0 // in H1n. rewrite -[_./2.+1]/(n./2.+2). @@ -1000,10 +1000,10 @@ rewrite -leq_double -!mul2n -expnS in H2n. apply: leq_trans H2n. rewrite mul2n !doubleS !ltnS. -by rewrite -[X in X <= _]odd_double_half -add1n leq_add2r; case: odd. +by rewrite -[leqLHS]odd_double_half -add1n leq_add2r; case: odd. Qed. -Lemma up_log_trunc_log p n : +Lemma up_log_trunc_log p n : 1 < p -> 1 < n -> up_log p n = (trunc_log p n.-1).+1. Proof. move=> p_gt1 n_gt1; apply: up_log_eq => //. @@ -1011,7 +1011,7 @@ by rewrite trunc_logP ?ltn_predRL// trunc_log_ltn. Qed. -Lemma trunc_log_up_log p n : +Lemma trunc_log_up_log p n : 1 < p -> 0 < n -> trunc_log p n = (up_log p n.+1).-1. Proof. by move=> ? ?; rewrite up_log_trunc_log. Qed. @@ -1201,7 +1201,7 @@ case p_pr: (prime p); first by rewrite p_part pfactorK. by rewrite lognE (lognE p m) p_pr. Qed. - + Lemma partn_lcm pi m n : m > 0 -> n > 0 -> (lcmn m n)`_pi = lcmn m`_pi n`_pi. Proof. move=> m_gt0 n_gt0; have p_gt0: lcmn m n > 0 by rewrite lcmn_gt0 m_gt0. @@ -1419,10 +1419,10 @@ Proof. by move=> pi'n pi_p; apply: sub_in_pnat pi'n => q _; apply: contraNneq => ->. Qed. - + Lemma pi_p'nat p pi n : pi.-nat n -> p \in pi^' -> p^'.-nat n. Proof. by move=> pi_n; apply: pi'_p'nat; rewrite pnatNK. Qed. - + Lemma partn_part pi rho n : {subset pi <= rho} -> n`_rho`_pi = n`_pi. Proof. move=> pi_sub_rho; have [->|n_gt0] := posnP n; first by rewrite !partn0 partn1. @@ -1443,7 +1443,7 @@ Proof. by case: n => // n; rewrite p'natE // dvdn2 negbK. Qed. End PnatTheory. -Hint Resolve part_gt0 : core. +#[global] Hint Resolve part_gt0 : core. (************************************) (* Properties of the divisors list. *) @@ -1619,12 +1619,3 @@ apply/eqP; rewrite /eq_op /= /eq_op /= !modn_dvdm ?dvdn_part //. by rewrite chinese_modl // chinese_modr // !modn_small ?eqxx ?ltn_ord. Qed. - -#[deprecated(since="mathcomp 1.12.0", note="Use primesM instead.")] -Notation primes_mul := primesM (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use primesX instead.")] -Notation primes_exp := primesX (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use pnatM instead.")] -Notation pnat_mul := pnatM (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use pnatX instead.")] -Notation pnat_exp := pnatX (only parsing). diff -Nru ssreflect-1.14.0/mathcomp/ssreflect/seq.v ssreflect-1.15.0/mathcomp/ssreflect/seq.v --- ssreflect-1.14.0/mathcomp/ssreflect/seq.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/ssreflect/seq.v 2022-06-30 08:50:47.000000000 +0000 @@ -89,6 +89,13 @@ (* uniq s <=> all the items in s are pairwise different. *) (* subseq s1 s2 <=> s1 is a subsequence of s2, i.e., s1 = mask m s2 for *) (* some m : bitseq (see below). *) +(* infix s1 s2 <=> s1 is a contiguous subsequence of s2, i.e., *) +(* s ++ s1 ++ s' = s2 for some sequences s, s'. *) +(* prefix s1 s2 <=> s1 is a subchain of s2 appearing at the beginning *) +(* of s2. *) +(* suffix s1 s2 <=> s1 is a subchain of s2 appearing at the end of s2. *) +(* infix_index s1 s2 <=> the first index at which s1 appears in s2, *) +(* or (size s2).+1 if infix s1 s2 is false. *) (* perm_eq s1 s2 <=> s2 is a permutation of s1, i.e., s1 and s2 have the *) (* items (with the same repetitions), but possibly in a *) (* different order. *) @@ -381,6 +388,9 @@ Lemma nth_nil n : nth [::] n = x0. Proof. by case: n. Qed. +Lemma nth_seq1 n x : nth [:: x] n = if n == 0 then x else x0. +Proof. by case: n => [|[]]. Qed. + Lemma last_nth x s : last x s = nth (x :: s) (size s). Proof. by elim: s x => [|y s IHs] x /=. Qed. @@ -740,6 +750,9 @@ by rewrite size_takel // ltnW. Qed. +Lemma size_take_min s : size (take n0 s) = minn n0 (size s). +Proof. exact: size_take. Qed. + Lemma take_cat s1 s2 : take n0 (s1 ++ s2) = if n0 < size s1 then take n0 s1 else s1 ++ take (n0 - size s1) s2. @@ -1040,6 +1053,8 @@ Lemma size_eq0 s : (size s == 0) = (s == [::]). Proof. exact: (sameP nilP eqP). Qed. +Lemma nilpE s : nilp s = (s == [::]). Proof. by case: s. Qed. + Lemma has_filter a s : has a s = (filter a s != [::]). Proof. by rewrite -size_eq0 size_filter has_count lt0n. Qed. @@ -1527,7 +1542,7 @@ (* makes `apply: allss` failing for the other case. Since both `mem` and *) (* `pred_of_seq` reduce to `mem_seq`, the following explicit type annotation *) (* for `allss` makes it work for both cases. *) -Hint Extern 0 (is_true (all _ _)) => +#[global] Hint Extern 0 (is_true (all _ _)) => apply: (allss : forall T s, all (mem_seq s) s) : core. Section NthTheory. @@ -1540,8 +1555,9 @@ Qed. Variable T : Type. +Implicit Types (a : pred T) (x : T). -Lemma has_nthP (a : pred T) s x0 : +Lemma has_nthP a s x0 : reflect (exists2 i, i < size s & a (nth x0 s i)) (has a s). Proof. elim: s => [|x s IHs] /=; first by right; case. @@ -1549,7 +1565,7 @@ by apply: (iffP IHs) => [[i]|[[|i]]]; [exists i.+1 | rewrite nax | exists i]. Qed. -Lemma all_nthP (a : pred T) s x0 : +Lemma all_nthP a s x0 : reflect (forall i, i < size s -> a (nth x0 s i)) (all a s). Proof. rewrite -(eq_all (fun x => negbK (a x))) all_predC. @@ -1558,6 +1574,44 @@ by apply/idPn=> na_si; case: a_s; exists i. Qed. +Lemma set_nthE s x0 n x : + set_nth x0 s n x = if n < size s + then take n s ++ x :: drop n.+1 s + else s ++ ncons (n - size s) x0 [:: x]. +Proof. +elim: s n => [|a s IH] n /=; first by rewrite subn0 set_nth_nil. +case: n => [|n]; first by rewrite drop0. +by rewrite ltnS /=; case: ltnP (IH n) => _ ->. +Qed. + +Lemma count_set_nth a s x0 n x : + count a (set_nth x0 s n x) = + count a s + a x - a (nth x0 s n) * (n < size s) + (a x0) * (n - size s). +Proof. +rewrite set_nthE; case: ltnP => [nlts|nges]; last first. + rewrite -cat_nseq !count_cat count_nseq /=. + by rewrite muln0 addn0 subn0 addnAC addnA. +have -> : n - size s = 0 by apply/eqP; rewrite subn_eq0 ltnW. +rewrite -[in count a s](cat_take_drop n s) [drop n s](drop_nth x0)//. +by rewrite !count_cat/= muln1 muln0 addn0 addnAC !addnA [in RHS]addnAC addnK. +Qed. + +Lemma count_set_nth_ltn a s x0 n x : n < size s -> + count a (set_nth x0 s n x) = count a s + a x - a (nth x0 s n). +Proof. +move=> nlts; rewrite count_set_nth nlts muln1. +have -> : n - size s = 0 by apply/eqP; rewrite subn_eq0 ltnW. +by rewrite muln0 addn0. +Qed. + +Lemma count_set_nthF a s x0 n x : ~~ a x0 -> + count a (set_nth x0 s n x) = count a s + a x - a (nth x0 s n). +Proof. +move=> /negbTE ax0; rewrite count_set_nth ax0 mul0n addn0. +case: ltnP => [_|nges]; first by rewrite muln1. +by rewrite nth_default// ax0 subn0. +Qed. + End NthTheory. Lemma set_nth_default T s (y0 x0 : T) n : n < size s -> nth x0 s n = nth y0 s n. @@ -1887,7 +1941,7 @@ Arguments permPl {T s1 s2}. Arguments permPr {T s1 s2}. Prenex Implicits perm_eq. -Hint Resolve perm_refl : core. +#[global] Hint Resolve perm_refl : core. Section RotrLemmas. @@ -2219,6 +2273,12 @@ by move/(@all_pred1P _ true)->; rewrite sz_m mask_true. Qed. +Lemma subseq_anti : antisymmetric subseq. +Proof. +move=> s1 s2 /andP[] /size_subseq_leqif /leqifP. +by case: eqP => [//|_] + /size_subseq; rewrite ltnNge => /negP. +Qed. + Lemma subseq_cons s x : subseq s (x :: s). Proof. exact: suffix_subseq [:: x] s. Qed. @@ -2261,7 +2321,7 @@ Proof. move=> /subseqP[m size_m ->]. exists (count id (take n m)); last by rewrite -mask_rot // mask_subseq. -by rewrite (leq_trans (count_size _ _))// size_take; case: ltnP. +by rewrite (leq_trans (count_size _ _))// size_take_min geq_minl. Qed. End Subseq. @@ -2269,7 +2329,7 @@ Prenex Implicits subseq. Arguments subseqP {T s1 s2}. -Hint Resolve subseq_refl : core. +#[global] Hint Resolve subseq_refl : core. Section Rem. @@ -2406,32 +2466,32 @@ End Map. Notation "[ 'seq' E | i <- s ]" := (map (fun i => E) s) - (at level 0, E at level 99, i ident, + (at level 0, E at level 99, i name, format "[ '[hv' 'seq' E '/ ' | i <- s ] ']'") : seq_scope. Notation "[ 'seq' E | i <- s & C ]" := [seq E | i <- [seq i <- s | C]] - (at level 0, E at level 99, i ident, + (at level 0, E at level 99, i name, format "[ '[hv' 'seq' E '/ ' | i <- s '/ ' & C ] ']'") : seq_scope. Notation "[ 'seq' E | i : T <- s ]" := (map (fun i : T => E) s) - (at level 0, E at level 99, i ident, only parsing) : seq_scope. + (at level 0, E at level 99, i name, only parsing) : seq_scope. Notation "[ 'seq' E | i : T <- s & C ]" := [seq E | i : T <- [seq i : T <- s | C]] - (at level 0, E at level 99, i ident, only parsing) : seq_scope. + (at level 0, E at level 99, i name, only parsing) : seq_scope. Notation "[ 'seq' E : R | i <- s ]" := (@map _ R (fun i => E) s) - (at level 0, E at level 99, i ident, only parsing) : seq_scope. + (at level 0, E at level 99, i name, only parsing) : seq_scope. Notation "[ 'seq' E : R | i <- s & C ]" := [seq E : R | i <- [seq i <- s | C]] - (at level 0, E at level 99, i ident, only parsing) : seq_scope. + (at level 0, E at level 99, i name, only parsing) : seq_scope. Notation "[ 'seq' E : R | i : T <- s ]" := (@map T R (fun i : T => E) s) - (at level 0, E at level 99, i ident, only parsing) : seq_scope. + (at level 0, E at level 99, i name, only parsing) : seq_scope. Notation "[ 'seq' E : R | i : T <- s & C ]" := [seq E : R | i : T <- [seq i : T <- s | C]] - (at level 0, E at level 99, i ident, only parsing) : seq_scope. + (at level 0, E at level 99, i name, only parsing) : seq_scope. Lemma filter_mask T a (s : seq T) : filter a s = mask (map a s) s. Proof. by elim: s => //= x s <-; case: (a x). Qed. @@ -2455,11 +2515,10 @@ Lemma mask_filter s m : uniq s -> mask m s = [seq i <- s | i \in mask m s]. Proof. -elim: m s => [|[] m ih] [|x s] //=. -- by move=> _; elim: s. -- case/andP => /negP x_notin_s /ih {1}->; rewrite inE eqxx /=; congr cons. - by apply/eq_in_filter => ? /[1!inE]; case: eqP => // ->. -- by case: ifP => [/mem_mask -> // | _ /andP [] _ /ih]. +elim: m s => [|[] m IH] [|x s /= /andP[/negP xS uS]]; rewrite ?filter_pred0 //. + rewrite inE eqxx /=; congr cons; rewrite [LHS]IH//. + by apply/eq_in_filter => ? /[1!inE]; case: eqP => [->|]. +by case: ifP => [/mem_mask //|_]; apply: IH. Qed. Lemma leq_count_subseq P s1 s2 : subseq s1 s2 -> count P s1 <= count P s2. @@ -2693,11 +2752,11 @@ End Pmap. -Lemma eq_in_pmap (aT : eqType) rT (f1 f2 : aT -> option rT) s : +Lemma eq_in_pmap (aT : eqType) rT (f1 f2 : aT -> option rT) s : {in s, f1 =1 f2} -> pmap f1 s = pmap f2 s. Proof. by elim: s => //= a s IHs /forall_cons [-> /IHs ->]. Qed. -Lemma eq_pmap aT rT (f1 f2 : aT -> option rT) : +Lemma eq_pmap aT rT (f1 f2 : aT -> option rT) : f1 =1 f2 -> pmap f1 =1 pmap f2. Proof. by move=> Ef; elim => //= a s ->; rewrite Ef. Qed. @@ -2817,6 +2876,10 @@ Lemma size_mkseq f n : size (mkseq f n) = n. Proof. by rewrite size_map size_iota. Qed. +Lemma mkseqS f n : + mkseq f n.+1 = rcons (mkseq f n) (f n). +Proof. by rewrite /mkseq -addn1 iotaD add0n map_cat cats1. Qed. + Lemma eq_mkseq f g : f =1 g -> mkseq f =1 mkseq g. Proof. by move=> Efg n; apply: eq_map Efg _. Qed. @@ -2854,6 +2917,13 @@ Variable T : eqType. +Lemma mkseq_uniqP (f : nat -> T) n : + reflect {in gtn n &, injective f} (uniq (mkseq f n)). +Proof. +apply: (equivP (uniqP (f 0))); rewrite size_mkseq. +by split=> injf i j lti ltj; have:= injf i j lti ltj; rewrite !nth_mkseq. +Qed. + Lemma mkseq_uniq (f : nat -> T) n : injective f -> uniq (mkseq f n). Proof. by move/map_inj_uniq->; apply: iota_uniq. Qed. @@ -3318,18 +3388,356 @@ Notation "[ 'seq' E | x <- s , y <- t ]" := (flatten [seq [seq E | y <- t] | x <- s]) - (at level 0, E at level 99, x ident, y ident, + (at level 0, E at level 99, x name, y name, format "[ '[hv' 'seq' E '/ ' | x <- s , '/ ' y <- t ] ']'") : seq_scope. Notation "[ 'seq' E | x : S <- s , y : T <- t ]" := (flatten [seq [seq E | y : T <- t] | x : S <- s]) - (at level 0, E at level 99, x ident, y ident, only parsing) : seq_scope. + (at level 0, E at level 99, x name, y name, only parsing) : seq_scope. Notation "[ 'seq' E : R | x : S <- s , y : T <- t ]" := (flatten [seq [seq E : R | y : T <- t] | x : S <- s]) - (at level 0, E at level 99, x ident, y ident, only parsing) : seq_scope. + (at level 0, E at level 99, x name, y name, only parsing) : seq_scope. Notation "[ 'seq' E : R | x <- s , y <- t ]" := (flatten [seq [seq E : R | y <- t] | x <- s]) - (at level 0, E at level 99, x ident, y ident, only parsing) : seq_scope. + (at level 0, E at level 99, x name, y name, only parsing) : seq_scope. + +Section PrefixSuffixInfix. + +Variables T : eqType. +Implicit Type s : seq T. + +Fixpoint prefix s1 s2 {struct s2} := + if s1 isn't x :: s1' then true else + if s2 isn't y :: s2' then false else + (x == y) && prefix s1' s2'. + +Lemma prefixE s1 s2 : prefix s1 s2 = (take (size s1) s2 == s1). +Proof. by elim: s2 s1 => [|y s2 +] [|x s1]//= => ->; rewrite eq_sym. Qed. + +Lemma prefix_refl s : prefix s s. Proof. by rewrite prefixE take_size. Qed. + +Lemma prefixs0 s : prefix s [::] = (s == [::]). Proof. by case: s. Qed. + +Lemma prefix0s s : prefix [::] s. Proof. by case: s. Qed. + +Lemma prefix_cons s1 s2 x y : + prefix (x :: s1) (y :: s2) = (x == y) && prefix s1 s2. +Proof. by []. Qed. + +Lemma prefix_catr s1 s2 s1' s3 : size s1 = size s1' -> + prefix (s1 ++ s2) (s1' ++ s3) = (s1 == s1') && prefix s2 s3. +Proof. +elim: s1 s1' => [|x s1 IHs1] [|y s1']//= [eqs1]. +by rewrite IHs1// eqseq_cons andbA. +Qed. + +Lemma prefix_prefix s1 s2 : prefix s1 (s1 ++ s2). +Proof. by rewrite prefixE take_cat ltnn subnn take0 cats0. Qed. +Hint Resolve prefix_prefix : core. + +Lemma prefixP {s1 s2} : + reflect (exists s2' : seq T, s2 = s1 ++ s2') (prefix s1 s2). +Proof. +apply: (iffP idP) => [|[{}s2 ->]]; last exact: prefix_prefix. +by rewrite prefixE => /eqP<-; exists (drop (size s1) s2); rewrite cat_take_drop. +Qed. + +Lemma prefix_trans : transitive prefix. +Proof. by move=> _ s2 _ /prefixP[s1 ->] /prefixP[s3 ->]; rewrite -catA. Qed. + +Lemma prefixs1 s x : prefix s [:: x] = (s == [::]) || (s == [:: x]). +Proof. by case: s => //= y s; rewrite prefixs0 eqseq_cons. Qed. + +Lemma catl_prefix s1 s2 s3 : prefix (s1 ++ s3) s2 -> prefix s1 s2. +Proof. by move=> /prefixP [s2'] ->; rewrite -catA. Qed. + +Lemma prefix_catl s1 s2 s3 : prefix s1 s2 -> prefix s1 (s2 ++ s3). +Proof. by move=> /prefixP [s2'] ->; rewrite -catA. Qed. + +Lemma prefix_rcons s x : prefix s (rcons s x). +Proof. by rewrite -cats1 prefix_prefix. Qed. + +Definition suffix s1 s2 := prefix (rev s1) (rev s2). + +Lemma suffixE s1 s2 : suffix s1 s2 = (drop (size s2 - size s1) s2 == s1). +Proof. by rewrite /suffix prefixE take_rev (can_eq revK) size_rev. Qed. + +Lemma suffix_refl s : suffix s s. +Proof. exact: prefix_refl. Qed. + +Lemma suffixs0 s : suffix s [::] = (s == [::]). +Proof. by rewrite /suffix prefixs0 -!nilpE rev_nilp. Qed. + +Lemma suffix0s s : suffix [::] s. +Proof. exact: prefix0s. Qed. + +Lemma prefix_rev s1 s2 : prefix (rev s1) (rev s2) = suffix s1 s2. +Proof. by []. Qed. + +Lemma prefix_revLR s1 s2 : prefix (rev s1) s2 = suffix s1 (rev s2). +Proof. by rewrite -prefix_rev revK. Qed. + +Lemma suffix_rev s1 s2 : suffix (rev s1) (rev s2) = prefix s1 s2. +Proof. by rewrite -prefix_rev !revK. Qed. + +Lemma suffix_revLR s1 s2 : suffix (rev s1) s2 = prefix s1 (rev s2). +Proof. by rewrite -prefix_rev revK. Qed. + +Lemma suffix_suffix s1 s2 : suffix s2 (s1 ++ s2). +Proof. by rewrite /suffix rev_cat prefix_prefix. Qed. +Hint Resolve suffix_suffix : core. + +Lemma suffixP {s1 s2} : + reflect (exists s2' : seq T, s2 = s2' ++ s1) (suffix s1 s2). +Proof. +apply: (iffP prefixP) => [[s2' rev_s2]|[s2' ->]]; exists (rev s2'); last first. + by rewrite rev_cat. +by rewrite -[s2]revK rev_s2 rev_cat revK. +Qed. + +Lemma suffix_trans : transitive suffix. +Proof. by move=> _ s2 _ /suffixP[s1 ->] /suffixP[s3 ->]; rewrite catA. Qed. + +Lemma suffix_rcons s1 s2 x y : + suffix (rcons s1 x) (rcons s2 y) = (x == y) && suffix s1 s2. +Proof. by rewrite /suffix 2!rev_rcons prefix_cons. Qed. + +Lemma suffix_catl s1 s2 s3 s3' : size s3 = size s3' -> + suffix (s1 ++ s3) (s2 ++ s3') = (s3 == s3') && suffix s1 s2. +Proof. +by move=> eqs3; rewrite /suffix !rev_cat prefix_catr ?size_rev// (can_eq revK). +Qed. + +Lemma suffix_catr s1 s2 s3 : suffix s1 s2 -> suffix s1 (s3 ++ s2). +Proof. by move=> /suffixP [s2'] ->; rewrite catA suffix_suffix. Qed. + +Lemma catl_suffix s s1 s2 : suffix (s ++ s1) s2 -> suffix s1 s2. +Proof. by move=> /suffixP [s2'] ->; rewrite catA suffix_suffix. Qed. + +Lemma suffix_cons s x : suffix s (x :: s). +Proof. by rewrite /suffix rev_cons prefix_rcons. Qed. + +Fixpoint infix s1 s2 := + if s2 is y :: s2' then prefix s1 s2 || infix s1 s2' else s1 == [::]. + +Fixpoint infix_index s1 s2 := + if prefix s1 s2 then 0 + else if s2 is y :: s2' then (infix_index s1 s2').+1 else 1. + +Lemma infix0s s : infix [::] s. Proof. by case: s. Qed. + +Lemma infixs0 s : infix s [::] = (s == [::]). Proof. by case: s. Qed. + +Lemma infix_consl s1 y s2 : + infix s1 (y :: s2) = prefix s1 (y :: s2) || infix s1 s2. +Proof. by []. Qed. + +Lemma infix_indexss s : infix_index s s = 0. +Proof. by case: s => //= x s; rewrite eqxx prefix_refl. Qed. + +Lemma infix_index_le s1 s2 : infix_index s1 s2 <= (size s2).+1. +Proof. by elim: s2 => [|x s2'] /=; case: ifP. Qed. + +Lemma infixTindex s1 s2 : (infix_index s1 s2 <= size s2) = infix s1 s2. +Proof. by elim: s2 s1 => [|y s2 +] [|x s1]//= => <-; case: ifP. Qed. + +Lemma infixPn s1 s2 : + reflect (infix_index s1 s2 = (size s2).+1) (~~ infix s1 s2). +Proof. +rewrite -infixTindex -ltnNge; apply: (iffP idP) => [s2lt|->//]. +by apply/eqP; rewrite eqn_leq s2lt infix_index_le. +Qed. + +Lemma infix_index0s s : infix_index [::] s = 0. +Proof. by case: s. Qed. + +Lemma infix_indexs0 s : infix_index s [::] = (s != [::]). +Proof. by case: s. Qed. + +Lemma infixE s1 s2 : infix s1 s2 = + (take (size s1) (drop (infix_index s1 s2) s2) == s1). +Proof. +elim: s2 s1 => [|y s2 +] [|x s1]//= => -> /=. +by case: ifP => // /andP[/eqP-> ps1s2/=]; rewrite eqseq_cons -prefixE eqxx. +Qed. + +Lemma infix_refl s : infix s s. +Proof. by rewrite infixE infix_indexss// drop0 take_size. Qed. + +Lemma prefixW s1 s2 : prefix s1 s2 -> infix s1 s2. +Proof. by elim: s2 s1 => [|y s2 IHs2] [|x s1]//=->. Qed. + +Lemma prefix_infix s1 s2 : infix s1 (s1 ++ s2). +Proof. exact: prefixW. Qed. +Hint Resolve prefix_infix : core. + +Lemma infix_infix s1 s2 s3 : infix s2 (s1 ++ s2 ++ s3). +Proof. by elim: s1 => //= x s1 ->; rewrite orbT. Qed. +Hint Resolve infix_infix : core. + +Lemma suffix_infix s1 s2 : infix s2 (s1 ++ s2). +Proof. by rewrite -[X in s1 ++ X]cats0. Qed. +Hint Resolve suffix_infix : core. + +Lemma infixP {s1 s2} : + reflect (exists s s' : seq T, s2 = s ++ s1 ++ s') (infix s1 s2). +Proof. +apply: (iffP idP) => [|[p [s {s2}->]]]//=; rewrite infixE => /eqP<-. +set k := infix_index _ _; exists (take k s2), (drop (size s1 + k) s2). +by rewrite -drop_drop !cat_take_drop. +Qed. + +Lemma infix_rev s1 s2 : infix (rev s1) (rev s2) = infix s1 s2. +Proof. +gen have sr : s1 s2 / infix s1 s2 -> infix (rev s1) (rev s2); last first. + by apply/idP/idP => /sr; rewrite ?revK. +by move=> /infixP[s [p ->]]; rewrite !rev_cat -catA. +Qed. + +Lemma suffixW s1 s2 : suffix s1 s2 -> infix s1 s2. +Proof. by rewrite -infix_rev; apply: prefixW. Qed. + +Lemma infix_trans : transitive infix. +Proof. +move=> s s1 s2 /infixP[s1p [s1s def_s]] /infixP[sp [ss def_s2]]. +by apply/infixP; exists (sp ++ s1p),(s1s ++ ss); rewrite def_s2 def_s -!catA. +Qed. + +Lemma infix_revLR s1 s2 : infix (rev s1) s2 = infix s1 (rev s2). +Proof. by rewrite -infix_rev revK. Qed. + +Lemma infix_rconsl s1 s2 y : + infix s1 (rcons s2 y) = suffix s1 (rcons s2 y) || infix s1 s2. +Proof. +rewrite -infix_rev rev_rcons infix_consl. +by rewrite -rev_rcons prefix_rev infix_rev. +Qed. + +Lemma infix_cons s x : infix s (x :: s). +Proof. by rewrite -cat1s suffix_infix. Qed. + +Lemma infixs1 s x : infix s [:: x] = (s == [::]) || (s == [:: x]). +Proof. by rewrite infix_consl prefixs1 orbC orbA orbb. Qed. + +Lemma catl_infix s s1 s2 : infix (s ++ s1) s2 -> infix s1 s2. +Proof. apply: infix_trans; exact/suffixW/suffix_suffix. Qed. + +Lemma catr_infix s s1 s2 : infix (s1 ++ s) s2 -> infix s1 s2. +Proof. +by rewrite -infix_rev rev_cat => /catl_infix; rewrite infix_rev. +Qed. + +Lemma cons2_infix s1 s2 x : infix (x :: s1) (x :: s2) -> infix s1 s2. +Proof. +by rewrite /= eqxx /= -cat1s => /orP[/prefixW//|]; exact: catl_infix. +Qed. + +Lemma rcons2_infix s1 s2 x : infix (rcons s1 x) (rcons s2 x) -> infix s1 s2. +Proof. by rewrite -infix_rev !rev_rcons => /cons2_infix; rewrite infix_rev. Qed. + +Lemma catr2_infix s s1 s2 : infix (s ++ s1) (s ++ s2) -> infix s1 s2. +Proof. by elim: s => //= x s IHs /cons2_infix. Qed. + +Lemma catl2_infix s s1 s2 : infix (s1 ++ s) (s2 ++ s) -> infix s1 s2. +Proof. by rewrite -infix_rev !rev_cat => /catr2_infix; rewrite infix_rev. Qed. + +Lemma infix_catl s1 s2 s3 : infix s1 s2 -> infix s1 (s3 ++ s2). +Proof. by move=> is12; apply: infix_trans is12 (suffix_infix _ _). Qed. + +Lemma infix_catr s1 s2 s3 : infix s1 s2 -> infix s1 (s2 ++ s3). +Proof. +case: s3 => [|x s /infixP [p [sf]] ->]; first by rewrite cats0. +by rewrite -catA; apply: infix_catl; rewrite -catA prefix_infix. +Qed. + +Lemma prefix_infix_trans s2 s1 s3 : + prefix s1 s2 -> infix s2 s3 -> infix s1 s3. +Proof. by move=> /prefixW/infix_trans; apply. Qed. + +Lemma suffix_infix_trans s2 s1 s3 : + suffix s1 s2 -> infix s2 s3 -> infix s1 s3. +Proof. by move=> /suffixW/infix_trans; apply. Qed. + +Lemma infix_prefix_trans s2 s1 s3 : + infix s1 s2 -> prefix s2 s3 -> infix s1 s3. +Proof. by move=> + /prefixW; apply: infix_trans. Qed. + +Lemma infix_suffix_trans s2 s1 s3 : + infix s1 s2 -> suffix s2 s3 -> infix s1 s3. +Proof. by move=> + /suffixW; apply: infix_trans. Qed. + +Lemma prefix_suffix_trans s2 s1 s3 : + prefix s1 s2 -> suffix s2 s3 -> infix s1 s3. +Proof. by move=> /prefixW + /suffixW +; apply: infix_trans. Qed. + +Lemma suffix_prefix_trans s2 s1 s3 : + suffix s1 s2 -> prefix s2 s3 -> infix s1 s3. +Proof. by move=> /suffixW + /prefixW +; apply: infix_trans. Qed. + +Lemma infixW s1 s2 : infix s1 s2 -> subseq s1 s2. +Proof. +move=> /infixP[sp [ss ->]]. +exact: subseq_trans (prefix_subseq _ _) (suffix_subseq _ _). +Qed. + +Lemma mem_infix s1 s2 : infix s1 s2 -> {subset s1 <= s2}. +Proof. by move=> /infixW subH; apply: mem_subseq. Qed. + +Lemma infix1s s x : infix [:: x] s = (x \in s). +Proof. by elim: s => // x' s /= ->; rewrite in_cons prefix0s andbT. Qed. + +Lemma prefix1s s x : prefix [:: x] s -> x \in s. +Proof. by rewrite -infix1s => /prefixW. Qed. + +Lemma suffix1s s x : suffix [:: x] s -> x \in s. +Proof. by rewrite -infix1s => /suffixW. Qed. + +Lemma infix_rcons s x : infix s (rcons s x). +Proof. by rewrite -cats1 prefix_infix. Qed. + +Lemma infix_uniq s1 s2 : infix s1 s2 -> uniq s2 -> uniq s1. +Proof. by move=> /infixW /subseq_uniq subH. Qed. + +Lemma prefix_uniq s1 s2 : prefix s1 s2 -> uniq s2 -> uniq s1. +Proof. by move=> /prefixW /infix_uniq preH. Qed. + +Lemma suffix_uniq s1 s2 : suffix s1 s2 -> uniq s2 -> uniq s1. +Proof. by move=> /suffixW /infix_uniq preH. Qed. + +Lemma prefix_take s i : prefix (take i s) s. +Proof. by rewrite -{2}[s](cat_take_drop i). Qed. + +Lemma suffix_drop s i : suffix (drop i s) s. +Proof. by rewrite -{2}[s](cat_take_drop i). Qed. + +Lemma infix_take s i : infix (take i s) s. +Proof. by rewrite prefixW // prefix_take. Qed. + +Lemma prefix_drop_gt0 s i : ~~ prefix (drop i s) s -> i > 0. +Proof. by case: i => //=; rewrite drop0 ltnn prefix_refl. Qed. + +Lemma infix_drop s i : infix (drop i s) s. +Proof. by rewrite -{2}[s](cat_take_drop i). Qed. + +Lemma consr_infix s1 s2 x : infix (x :: s1) s2 -> infix [:: x] s2. +Proof. by rewrite -cat1s => /catr_infix. Qed. + +Lemma consl_infix s1 s2 x : infix (x :: s1) s2 -> infix s1 s2. +Proof. by rewrite -cat1s => /catl_infix. Qed. + +Lemma prefix_index s1 s2 : prefix s1 s2 -> infix_index s1 s2 = 0. +Proof. by case: s1 s2 => [|x s1] [|y s2] //= ->. Qed. + +Lemma size_infix s1 s2 : infix s1 s2 -> size s1 <= size s2. +Proof. by move=> /infixW; apply: size_subseq. Qed. + +Lemma size_prefix s1 s2 : prefix s1 s2 -> size s1 <= size s2. +Proof. by move=> /prefixW; apply: size_infix. Qed. + +Lemma size_suffix s1 s2 : suffix s1 s2 -> size s1 <= size s2. +Proof. by move=> /suffixW; apply: size_infix. Qed. + +End PrefixSuffixInfix. Section AllPairsDep. @@ -3559,10 +3967,10 @@ Proof. by move=> eq_s eq_t; apply: mem_allpairs_dep. Qed. Lemma allpairs_uniq f s t (st := [seq (x, y) | x <- s, y <- t]) : - uniq s -> uniq t -> {in st &, injective (prod_curry f)} -> + uniq s -> uniq t -> {in st &, injective (uncurry f)} -> uniq [seq f x y | x <- s, y <- t]. Proof. -move=> Us Ut inj_f; rewrite -(map_allpairs (prod_curry f) (@pair S T)) -/st. +move=> Us Ut inj_f; rewrite -(map_allpairs (uncurry f) (@pair S T)) -/st. rewrite map_inj_in_uniq // allpairs_uniq_dep {Us Ut st inj_f}//. by apply: in2W => -[x1 y1] [x2 y2] /= [-> ->]. Qed. @@ -4155,19 +4563,5 @@ Ltac tfae := do !apply: AllIffConj. (* Temporary backward compatibility. *) -#[deprecated(since="mathcomp 1.11.0", note="Use takeD instead.")] -Notation take_addn := takeD (only parsing). -#[deprecated(since="mathcomp 1.11.0", note="Use rotD instead.")] -Notation rot_addn := rotD (only parsing). -#[deprecated(since="mathcomp 1.11.0", note="Use nseqD instead.")] -Notation nseq_addn := nseqD (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use mem_allpairs_catr instead.")] -Notation allpairs_catr := mem_allpairs_catr (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use mem_allpairs_consr instead.")] -Notation allpairs_consr := mem_allpairs_consr (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use allpairs_rconsr instead.")] -Notation perm_allpairs_rconsr := allpairs_rconsr (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use iotaDl instead.")] -Notation iota_addl := iotaDl (only parsing). #[deprecated(since="mathcomp 1.13.0", note="Use iotaD instead.")] Notation iota_add := iotaD (only parsing). diff -Nru ssreflect-1.14.0/mathcomp/ssreflect/ssrAC.v ssreflect-1.15.0/mathcomp/ssreflect/ssrAC.v --- ssreflect-1.14.0/mathcomp/ssreflect/ssrAC.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/ssreflect/ssrAC.v 2022-06-30 08:50:47.000000000 +0000 @@ -88,9 +88,9 @@ Module Import Syntax. Bind Scope AC_scope with syntax. +Number Notation positive Pos.of_num_int Pos.to_num_uint : AC_scope. Coercion Leaf : positive >-> syntax. Coercion Leaf_of_nat : nat >-> syntax. -Notation "1" := 1%positive : AC_scope. Notation "x * y" := (Op x%AC y%AC) : AC_scope. End Syntax. @@ -228,11 +228,11 @@ Notation opACl op s := (opAC op (AC.Leaf_of_nat (size (AC.serial s%AC))) s%AC) (only parsing). -Notation "op .[ 'ACof' p s ]" := (opACof op p s) +Notation "op .[ 'ACof' p s ]" := (opACof op p%AC s%AC) (at level 2, p at level 1, left associativity, only parsing). -Notation "op .[ 'AC' p s ]" := (opAC op p s) +Notation "op .[ 'AC' p s ]" := (opAC op p%AC s%AC) (at level 2, p at level 1, left associativity, only parsing). -Notation "op .[ 'ACl' s ]" := (opACl op s) +Notation "op .[ 'ACl' s ]" := (opACl op s%AC) (at level 2, left associativity, only parsing). Notation AC_strategy := diff -Nru ssreflect-1.14.0/mathcomp/ssreflect/ssrbool.v ssreflect-1.15.0/mathcomp/ssreflect/ssrbool.v --- ssreflect-1.14.0/mathcomp/ssreflect/ssrbool.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/ssreflect/ssrbool.v 2022-06-30 08:50:47.000000000 +0000 @@ -1,106 +1,9 @@ From mathcomp Require Import ssreflect ssrfun. From Coq Require Export ssrbool. -(******************************************************************************) -(* Local additions: *) -(* {pred T} == a type convertible to pred T but that presents the *) -(* pred_sort coercion class. *) -(* PredType toP == the predType structure for toP : A -> pred T. *) -(* relpre f r == the preimage of r by f, simplifying to r (f x) (f y). *) -(* --> These will become part of the core SSReflect library with Coq 8.11. *) -(* This file also anticipates a v8.11 change in the definition of simpl_pred *) -(* to T -> simpl_pred T. This change ensures that inE expands the definition *) -(* of r : simpl_rel along with the \in, when rewriting in y \in r x. *) -(* *) -(* This file also anticipates v8.13 additions as well as a generalization in *) -(* the statments of `homoRL_in`, `homoLR_in`, `homo_mono_in`, `monoLR_in`, *) -(* monoRL_in, and can_mono_in. *) -(******************************************************************************) - -(******************) -(* v8.11 addtions *) -(******************) - -Notation "{ 'pred' T }" := (pred_sort (predPredType T)) (at level 0, - format "{ 'pred' T }") : type_scope. - -Lemma simpl_pred_sortE T (p : pred T) : (SimplPred p : {pred T}) =1 p. -Proof. by []. Qed. -Definition inE := (inE, simpl_pred_sortE). - -Definition PredType : forall T pT, (pT -> pred T) -> predType T. -exact PredType || exact mkPredType. -Defined. -Arguments PredType [T pT] toP. - -Definition simpl_rel T := T -> simpl_pred T. -Definition SimplRel {T} (r : rel T) : simpl_rel T := fun x => SimplPred (r x). -Coercion rel_of_simpl_rel T (sr : simpl_rel T) : rel T := sr. -Arguments rel_of_simpl_rel {T} sr x / y : rename. - -(* Required to avoid an incompatible format warning with coq-8.12 *) -Reserved Notation "[ 'rel' x y : T | E ]" (at level 0, x ident, y ident, - format "'[hv' [ 'rel' x y : T | '/ ' E ] ']'"). - -Notation "[ 'rel' x y | E ]" := (SimplRel (fun x y => E%B)) (at level 0, - x ident, y ident, format "'[hv' [ 'rel' x y | '/ ' E ] ']'") : fun_scope. -Notation "[ 'rel' x y : T | E ]" := (SimplRel (fun x y : T => E%B)) - (only parsing) : fun_scope. -Notation "[ 'rel' x y 'in' A & B | E ]" := - [rel x y | (x \in A) && (y \in B) && E] (at level 0, x ident, y ident, - format "'[hv' [ 'rel' x y 'in' A & B | '/ ' E ] ']'") : fun_scope. -Notation "[ 'rel' x y 'in' A & B ]" := [rel x y | (x \in A) && (y \in B)] - (at level 0, x ident, y ident, - format "'[hv' [ 'rel' x y 'in' A & B ] ']'") : fun_scope. -Notation "[ 'rel' x y 'in' A | E ]" := [rel x y in A & A | E] - (at level 0, x ident, y ident, - format "'[hv' [ 'rel' x y 'in' A | '/ ' E ] ']'") : fun_scope. -Notation "[ 'rel' x y 'in' A ]" := [rel x y in A & A] (at level 0, - x ident, y ident, format "'[hv' [ 'rel' x y 'in' A ] ']'") : fun_scope. - -Notation xrelpre := (fun f (r : rel _) x y => r (f x) (f y)). -Definition relpre {T rT} (f : T -> rT) (r : rel rT) := - [rel x y | r (f x) (f y)]. - -(******************) -(* v8.13 addtions *) -(******************) - -Section HomoMonoMorphismFlip. -Variables (aT rT : Type) (aR : rel aT) (rR : rel rT) (f : aT -> rT). -Variable (aD aD' : {pred aT}). - -Lemma homo_sym : {homo f : x y / aR x y >-> rR x y} -> - {homo f : y x / aR x y >-> rR x y}. -Proof. by move=> fR y x; apply: fR. Qed. - -Lemma mono_sym : {mono f : x y / aR x y >-> rR x y} -> - {mono f : y x / aR x y >-> rR x y}. -Proof. by move=> fR y x; apply: fR. Qed. - -Lemma homo_sym_in : {in aD &, {homo f : x y / aR x y >-> rR x y}} -> - {in aD &, {homo f : y x / aR x y >-> rR x y}}. -Proof. by move=> fR y x yD xD; apply: fR. Qed. - -Lemma mono_sym_in : {in aD &, {mono f : x y / aR x y >-> rR x y}} -> - {in aD &, {mono f : y x / aR x y >-> rR x y}}. -Proof. by move=> fR y x yD xD; apply: fR. Qed. - -Lemma homo_sym_in11 : {in aD & aD', {homo f : x y / aR x y >-> rR x y}} -> - {in aD' & aD, {homo f : y x / aR x y >-> rR x y}}. -Proof. by move=> fR y x yD xD; apply: fR. Qed. - -Lemma mono_sym_in11 : {in aD & aD', {mono f : x y / aR x y >-> rR x y}} -> - {in aD' & aD, {mono f : y x / aR x y >-> rR x y}}. -Proof. by move=> fR y x yD xD; apply: fR. Qed. - -End HomoMonoMorphismFlip. -Arguments homo_sym {aT rT} [aR rR f]. -Arguments mono_sym {aT rT} [aR rR f]. -Arguments homo_sym_in {aT rT} [aR rR f aD]. -Arguments mono_sym_in {aT rT} [aR rR f aD]. -Arguments homo_sym_in11 {aT rT} [aR rR f aD aD']. -Arguments mono_sym_in11 {aT rT} [aR rR f aD aD']. +(* 8.11 addition in Coq but renamed *) +#[deprecated(since="mathcomp 1.15", note="Use rel_of_simpl instead.")] +Notation rel_of_simpl_rel := rel_of_simpl. (******************) (* v8.14 addtions *) @@ -213,155 +116,6 @@ Arguments in_on1lS {T1 T2 T3} D2 {f h Q1l}. Arguments in_on2S {T1 T2} D2 {f Q2}. -(******************) -(* v8.13 addtions *) -(******************) - -Section CancelOn. - -Variables (aT rT : predArgType) (aD : {pred aT}) (rD : {pred rT}). -Variables (f : aT -> rT) (g : rT -> aT). - -Lemma onW_can : cancel g f -> {on aD, cancel g & f}. Proof. exact: on1lW. Qed. - -Lemma onW_can_in : {in rD, cancel g f} -> {in rD, {on aD, cancel g & f}}. -Proof. exact: on1lW_in. Qed. - -Lemma in_onW_can : cancel g f -> {in rD, {on aD, cancel g & f}}. -Proof. exact: in_on1lW. Qed. - -Lemma onS_can : (forall x, g x \in aD) -> {on aD, cancel g & f} -> cancel g f. -Proof. exact: on1lS. Qed. - -Lemma onS_can_in : {homo g : x / x \in rD >-> x \in aD} -> - {in rD, {on aD, cancel g & f}} -> {in rD, cancel g f}. -Proof. exact: on1lS_in. Qed. - -Lemma in_onS_can : (forall x, g x \in aD) -> - {in rT, {on aD, cancel g & f}} -> cancel g f. -Proof. exact: in_on1lS. Qed. - -End CancelOn. -Arguments onW_can {aT rT} aD {f g}. -Arguments onW_can_in {aT rT} aD {rD f g}. -Arguments in_onW_can {aT rT} aD rD {f g}. -Arguments onS_can {aT rT} aD {f g}. -Arguments onS_can_in {aT rT} aD {rD f g}. -Arguments in_onS_can {aT rT} aD {f g}. - -Section MonoHomoMorphismTheory_in. - -Variables (aT rT : predArgType) (aD : {pred aT}) (rD : {pred rT}). -Variables (f : aT -> rT) (g : rT -> aT) (aR : rel aT) (rR : rel rT). - -Hypothesis fgK : {in rD, {on aD, cancel g & f}}. -Hypothesis mem_g : {homo g : x / x \in rD >-> x \in aD}. - -Lemma homoRL_in : - {in aD &, {homo f : x y / aR x y >-> rR x y}} -> - {in rD & aD, forall x y, aR (g x) y -> rR x (f y)}. -Proof. by move=> Hf x y hx hy /Hf; rewrite fgK ?mem_g// ?inE; apply. Qed. - -Lemma homoLR_in : - {in aD &, {homo f : x y / aR x y >-> rR x y}} -> - {in aD & rD, forall x y, aR x (g y) -> rR (f x) y}. -Proof. by move=> Hf x y hx hy /Hf; rewrite fgK ?mem_g// ?inE; apply. Qed. - -Lemma homo_mono_in : - {in aD &, {homo f : x y / aR x y >-> rR x y}} -> - {in rD &, {homo g : x y / rR x y >-> aR x y}} -> - {in rD &, {mono g : x y / rR x y >-> aR x y}}. -Proof. -move=> mf mg x y hx hy; case: (boolP (rR _ _))=> [/mg //|]; first exact. -by apply: contraNF=> /mf; rewrite !fgK ?mem_g//; apply. -Qed. - -Lemma monoLR_in : - {in aD &, {mono f : x y / aR x y >-> rR x y}} -> - {in aD & rD, forall x y, rR (f x) y = aR x (g y)}. -Proof. by move=> mf x y hx hy; rewrite -{1}[y]fgK ?mem_g// mf ?mem_g. Qed. - -Lemma monoRL_in : - {in aD &, {mono f : x y / aR x y >-> rR x y}} -> - {in rD & aD, forall x y, rR x (f y) = aR (g x) y}. -Proof. by move=> mf x y hx hy; rewrite -{1}[x]fgK ?mem_g// mf ?mem_g. Qed. - -Lemma can_mono_in : - {in aD &, {mono f : x y / aR x y >-> rR x y}} -> - {in rD &, {mono g : x y / rR x y >-> aR x y}}. -Proof. by move=> mf x y hx hy; rewrite -mf ?mem_g// !fgK ?mem_g. Qed. - -End MonoHomoMorphismTheory_in. -Arguments homoRL_in {aT rT aD rD f g aR rR}. -Arguments homoLR_in {aT rT aD rD f g aR rR}. -Arguments homo_mono_in {aT rT aD rD f g aR rR}. -Arguments monoLR_in {aT rT aD rD f g aR rR}. -Arguments monoRL_in {aT rT aD rD f g aR rR}. -Arguments can_mono_in {aT rT aD rD f g aR rR}. - -Section inj_can_sym_in_on. -Variables (aT rT : predArgType) (aD : {pred aT}) (rD : {pred rT}). -Variables (f : aT -> rT) (g : rT -> aT). - -Lemma inj_can_sym_in_on : - {homo f : x / x \in aD >-> x \in rD} -> {in aD, {on rD, cancel f & g}} -> - {in rD &, {on aD &, injective g}} -> {in rD, {on aD, cancel g & f}}. -Proof. by move=> fD fK gI x x_rD gx_aD; apply: gI; rewrite ?inE ?fK ?fD. Qed. - -Lemma inj_can_sym_on : {in aD, cancel f g} -> - {on aD &, injective g} -> {on aD, cancel g & f}. -Proof. by move=> fK gI x gx_aD; apply: gI; rewrite ?inE ?fK. Qed. - -Lemma inj_can_sym_in : {homo f \o g : x / x \in rD} -> {on rD, cancel f & g} -> - {in rD &, injective g} -> {in rD, cancel g f}. -Proof. by move=> fgD fK gI x x_rD; apply: gI; rewrite ?fK ?fgD. Qed. - -End inj_can_sym_in_on. -Arguments inj_can_sym_in_on {aT rT aD rD f g}. -Arguments inj_can_sym_on {aT rT aD f g}. -Arguments inj_can_sym_in {aT rT rD f g}. - -(* additional contra lemmas involving [P,Q : Prop] *) - -Section Contra. -Implicit Types (P Q : Prop) (b : bool). - -Lemma contra_not P Q : (Q -> P) -> (~ P -> ~ Q). Proof. by auto. Qed. - -Lemma contraPnot P Q : (Q -> ~ P) -> (P -> ~ Q). Proof. by auto. Qed. - -Lemma contraTnot b P : (P -> ~~ b) -> (b -> ~ P). -Proof. by case: b; auto. Qed. - -Lemma contraNnot P b : (P -> b) -> (~~ b -> ~ P). -Proof. rewrite -{1}[b]negbK; exact: contraTnot. Qed. - -Lemma contraPT P b : (~~ b -> ~ P) -> P -> b. -Proof. by case: b => //= /(_ isT) nP /nP. Qed. - -Lemma contra_notT P b : (~~ b -> P) -> ~ P -> b. -Proof. by case: b => //= /(_ isT) HP /(_ HP). Qed. - -Lemma contra_notN P b : (b -> P) -> ~ P -> ~~ b. -Proof. rewrite -{1}[b]negbK; exact: contra_notT. Qed. - -Lemma contraPN P b : (b -> ~ P) -> (P -> ~~ b). -Proof. by case: b => //=; move/(_ isT) => HP /HP. Qed. - -Lemma contraFnot P b : (P -> b) -> b = false -> ~ P. -Proof. by case: b => //; auto. Qed. - -Lemma contraPF P b : (b -> ~ P) -> P -> b = false. -Proof. by case: b => // /(_ isT). Qed. - -Lemma contra_notF P b : (b -> P) -> ~ P -> b = false. -Proof. by case: b => // /(_ isT). Qed. -End Contra. - -(******************) -(* v8.14 addtions *) -(******************) - Section in_sig. Local Notation "{ 'all1' P }" := (forall x, P x : Prop) (at level 0). Local Notation "{ 'all2' P }" := (forall x y, P x y : Prop) (at level 0). @@ -418,3 +172,93 @@ Arguments orPP {P Q p q}. Arguments implyPP {P Q p q}. Prenex Implicits negPP andPP orPP implyPP. + +(*******************) +(* v8.16 additions *) +(*******************) + +(******************************************************************************) +(* pred_oapp T D := [pred x | oapp (mem D) false x] *) +(******************************************************************************) + +Lemma mono1W_in (aT rT : predArgType) (f : aT -> rT) (aD : {pred aT}) + (aP : pred aT) (rP : pred rT) : + {in aD, {mono f : x / aP x >-> rP x}} -> + {in aD, {homo f : x / aP x >-> rP x}}. +Proof. by move=> fP x xD xP; rewrite fP. Qed. +Arguments mono1W_in [aT rT f aD aP rP]. + +#[deprecated(since="mathcomp 1.14.0", note="Use mono1W_in instead.")] +Notation mono2W_in := mono1W_in. + +Set Implicit Arguments. +Unset Strict Implicit. +Unset Printing Implicit Defensive. + +(*******************) +(* v8.17 additions *) +(*******************) + +Lemma all_sig2_cond {I T} (C : pred I) P Q : + T -> (forall x, C x -> {y : T | P x y & Q x y}) -> + {f : I -> T | forall x, C x -> P x (f x) & forall x, C x -> Q x (f x)}. +Proof. +by move=> /all_sig_cond/[apply]-[f Pf]; exists f => i Di; have [] := Pf i Di. +Qed. + +Lemma can_in_pcan [rT aT : Type] (A : {pred aT}) [f : aT -> rT] [g : rT -> aT] : + {in A, cancel f g} -> {in A, pcancel f (fun y : rT => Some (g y))}. +Proof. by move=> fK x Ax; rewrite fK. Qed. + +Lemma pcan_in_inj [rT aT : Type] [A : {pred aT}] + [f : aT -> rT] [g : rT -> option aT] : + {in A, pcancel f g} -> {in A &, injective f}. +Proof. by move=> fK x y Ax Ay /(congr1 g); rewrite !fK// => -[]. Qed. + +Lemma in_inj_comp A B C (f : B -> A) (h : C -> B) (P : pred B) (Q : pred C) : + {in P &, injective f} -> {in Q &, injective h} -> {homo h : x / Q x >-> P x} -> + {in Q &, injective (f \o h)}. +Proof. +by move=> Pf Qh QP x y xQ yQ xy; apply Qh => //; apply Pf => //; apply QP. +Qed. + +Lemma can_in_comp [A B C : Type] (D : {pred B}) (D' : {pred C}) + [f : B -> A] [h : C -> B] [f' : A -> B] [h' : B -> C] : + {homo h : x / x \in D' >-> x \in D} -> + {in D, cancel f f'} -> {in D', cancel h h'} -> + {in D', cancel (f \o h) (h' \o f')}. +Proof. by move=> hD fK hK c cD /=; rewrite fK ?hK ?hD. Qed. + +Lemma pcan_in_comp [A B C : Type] (D : {pred B}) (D' : {pred C}) + [f : B -> A] [h : C -> B] [f' : A -> option B] [h' : B -> option C] : + {homo h : x / x \in D' >-> x \in D} -> + {in D, pcancel f f'} -> {in D', pcancel h h'} -> + {in D', pcancel (f \o h) (obind h' \o f')}. +Proof. by move=> hD fK hK c cD /=; rewrite fK/= ?hK ?hD. Qed. + +Definition pred_oapp T (D : {pred T}) : pred (option T) := + [pred x | oapp (mem D) false x]. + +Lemma ocan_in_comp [A B C : Type] (D : {pred B}) (D' : {pred C}) + [f : B -> option A] [h : C -> option B] [f' : A -> B] [h' : B -> C] : + {homo h : x / x \in D' >-> x \in pred_oapp D} -> + {in D, ocancel f f'} -> {in D', ocancel h h'} -> + {in D', ocancel (obind f \o h) (h' \o f')}. +Proof. +move=> hD fK hK c cD /=; rewrite -[RHS]hK/=; case hcE : (h c) => [b|]//=. +have bD : b \in D by have := hD _ cD; rewrite hcE inE. +by rewrite -[b in RHS]fK; case: (f b) => //=; have /hK := cD; rewrite hcE. +Qed. + +Lemma eqbLR (b1 b2 : bool) : b1 = b2 -> b1 -> b2. +Proof. by move->. Qed. + +Lemma eqbRL (b1 b2 : bool) : b1 = b2 -> b2 -> b1. +Proof. by move->. Qed. + +Lemma homo_mono1 [aT rT : Type] [f : aT -> rT] [g : rT -> aT] + [aP : pred aT] [rP : pred rT] : + cancel g f -> + {homo f : x / aP x >-> rP x} -> + {homo g : x / rP x >-> aP x} -> {mono g : x / rP x >-> aP x}. +Proof. by move=> gK fP gP x; apply/idP/idP => [/fP|/gP//]; rewrite gK. Qed. diff -Nru ssreflect-1.14.0/mathcomp/ssreflect/ssreflect.v ssreflect-1.15.0/mathcomp/ssreflect/ssreflect.v --- ssreflect-1.14.0/mathcomp/ssreflect/ssreflect.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/ssreflect/ssreflect.v 2022-06-30 08:50:47.000000000 +0000 @@ -7,51 +7,18 @@ (******************************************************************************) (* Local additions: *) -(* nonPropType == an interface for non-Prop Types: a nonPropType coerces *) -(* to a Type, and only types that do _not_ have sort *) -(* Prop are canonical nonPropType instances. This is *) -(* useful for applied views. *) -(* --> This will become standard with the Coq v8.11 SSReflect core library. *) +(* *) +(* [elaborate x] == triggers coq elaboration to fill the holes of the term x *) +(* The main use case is to trigger typeclass inference in *) +(* the body of a ssreflect have := [elaborate body]. *) (* *) (* Intro pattern ltac views: *) (* - calling rewrite from an intro pattern, use with parsimony *) (* => /[1! rules] := rewrite rules *) (* => /[! rules] := rewrite !rules *) -(* - top of the stack actions: *) -(* => /[apply] := => hyp {}/hyp *) -(* => /[swap] := => x y; move: y x *) -(* (also swap and perserves let bindings) *) -(* => /[dup] := => x; have copy := x; move: copy x *) -(* (also copies and preserves let bindings) *) (******************************************************************************) -Module NonPropType. - -Structure call_of (condition : unit) (result : bool) := Call {callee : Type}. -Definition maybeProp (T : Type) := tt. -Definition call T := Call (maybeProp T) false T. - -Structure test_of (result : bool) := Test {condition :> unit}. -Definition test_Prop (P : Prop) := Test true (maybeProp P). -Definition test_negative := Test false tt. - -Structure type := - Check {result : bool; test : test_of result; frame : call_of test result}. -Definition check result test frame := @Check result test frame. - -Module Exports. -Canonical call. -Canonical test_Prop. -Canonical test_negative. -Canonical check. -Notation nonPropType := type. -Coercion callee : call_of >-> Sortclass. -Coercion frame : type >-> call_of. -Notation notProp T := (@check false test_negative (call T)). -End Exports. - -End NonPropType. -Export NonPropType.Exports. +Reserved Notation "[ 'elaborate' x ]" (at level 0). Module Deprecation. @@ -92,41 +59,24 @@ End Deprecation. Export Deprecation.Exports. +Notation "[ 'elaborate' x ]" := (ltac:(refine x)) (only parsing). + Module Export ipat. Notation "'[' '1' '!' rules ']'" := (ltac:(rewrite rules)) (at level 0, rules at level 200, only parsing) : ssripat_scope. Notation "'[' '!' rules ']'" := (ltac:(rewrite !rules)) (at level 0, rules at level 200, only parsing) : ssripat_scope. -Notation "'[' 'apply' ']'" := (ltac:(let f := fresh "_top_" in move=> f {}/f)) - (at level 0, only parsing) : ssripat_scope. - -(* we try to preserve the naming by matching the names from the goal *) -(* we do move to perform a hnf before trying to match *) -Notation "'[' 'swap' ']'" := (ltac:(move; - let x := lazymatch goal with - | |- forall (x : _), _ => fresh x | |- let x := _ in _ => fresh x | _ => fresh "_top_" - end in intro x; move; - let y := lazymatch goal with - | |- forall (y : _), _ => fresh y | |- let y := _ in _ => fresh y | _ => fresh "_top_" - end in intro y; revert x; revert y)) - (at level 0, only parsing) : ssripat_scope. - -(* we try to preserve the naming by matching the names from the goal *) -(* we do move to perform a hnf before trying to match *) -Notation "'[' 'dup' ']'" := (ltac:(move; - lazymatch goal with - | |- forall (x : _), _ => - let x := fresh x in intro x; - let copy := fresh x in have copy := x; revert x; revert copy - | |- let x := _ in _ => - let x := fresh x in intro x; - let copy := fresh x in pose copy := x; - do [unfold x in (value of copy)]; revert x; revert copy - | |- _ => - let x := fresh "_top_" in move=> x; - let copy := fresh "_top" in have copy := x; revert x; revert copy - end)) - (at level 0, only parsing) : ssripat_scope. End ipat. + +(* A class to trigger reduction by rewriting. *) +(* Usage: rewrite [pattern]vm_compute. *) +(* Alternatively one may redefine a lemma as in algebra/rat.v : *) +(* Lemma rat_vm_compute n (x : rat) : vm_compute_eq n%:Q x -> n%:Q = x. *) +(* Proof. exact. Qed. *) + +Class vm_compute_eq {T : Type} (x y : T) := vm_compute : x = y. + +Hint Extern 0 (@vm_compute_eq _ _ _) => + vm_compute; reflexivity : typeclass_instances. diff -Nru ssreflect-1.14.0/mathcomp/ssreflect/ssrfun.v ssreflect-1.15.0/mathcomp/ssreflect/ssrfun.v --- ssreflect-1.14.0/mathcomp/ssreflect/ssrfun.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/ssreflect/ssrfun.v 2022-06-30 08:50:47.000000000 +0000 @@ -2,27 +2,62 @@ From Coq Require Export ssrfun. From mathcomp Require Export ssrnotations. +Definition injective2 (rT aT1 aT2 : Type) (f : aT1 -> aT2 -> rT) := + forall (x1 x2 : aT1) (y1 y2 : aT2), f x1 y1 = f x2 y2 -> (x1 = x2) * (y1 = y2). + +Arguments injective2 [rT aT1 aT2] f. + +(*******************) +(* v8.17 additions *) +(*******************) + (******************************************************************************) -(* Local additions: *) -(* void == a notation for the Empty_set type of the standard library. *) -(* of_void T == the canonical injection void -> T. *) +(* oflit f := Some \o f *) (******************************************************************************) -Lemma Some_inj {T : nonPropType} : injective (@Some T). -Proof. by move=> x y []. Qed. +Set Implicit Arguments. +Unset Strict Implicit. +Unset Printing Implicit Defensive. + +Definition olift aT rT (f : aT -> rT) := Some \o f. -Notation void := Empty_set. +Lemma obindEapp {aT rT} (f : aT -> option rT) : obind f = oapp f None. +Proof. by []. Qed. -Definition of_void T (x : void) : T := match x with end. +Lemma omapEbind {aT rT} (f : aT -> rT) : omap f = obind (olift f). +Proof. by []. Qed. -Lemma of_voidK T : pcancel (of_void T) [fun _ => None]. +Lemma omapEapp {aT rT} (f : aT -> rT) : omap f = oapp (olift f) None. +Proof. by []. Qed. + +Lemma oappEmap {aT rT} (f : aT -> rT) (y0 : rT) x : + oapp f y0 x = odflt y0 (omap f x). +Proof. by case: x. Qed. + +Lemma omap_comp aT rT sT (f : aT -> rT) (g : rT -> sT) : + omap (g \o f) =1 omap g \o omap f. Proof. by case. Qed. -Lemma inj_compr A B C (f : B -> A) (h : C -> B) : - injective (f \o h) -> injective h. -Proof. by move=> fh_inj x y /(congr1 f) /fh_inj. Qed. +Lemma oapp_comp aT rT sT (f : aT -> rT) (g : rT -> sT) x : + oapp (g \o f) x =1 (@oapp _ _)^~ x g \o omap f. +Proof. by case. Qed. -Definition injective2 (rT aT1 aT2 : Type) (f : aT1 -> aT2 -> rT) := - forall (x1 x2 : aT1) (y1 y2 : aT2), f x1 y1 = f x2 y2 -> (x1 = x2) * (y1 = y2). +Lemma oapp_comp_f {aT rT sT} (f : aT -> rT) (g : rT -> sT) (x : rT) : + oapp (g \o f) (g x) =1 g \o oapp f x. +Proof. by case. Qed. -Arguments injective2 [rT aT1 aT2] f. +Lemma olift_comp aT rT sT (f : aT -> rT) (g : rT -> sT) : + olift (g \o f) = olift g \o f. +Proof. by []. Qed. + +Lemma compA {A B C D : Type} (f : B -> A) (g : C -> B) (h : D -> C) : + f \o (g \o h) = (f \o g) \o h. +Proof. by []. Qed. + +Lemma ocan_comp [A B C : Type] [f : B -> option A] [h : C -> option B] + [f' : A -> B] [h' : B -> C] : + ocancel f f' -> ocancel h h' -> ocancel (obind f \o h) (h' \o f'). +Proof. +move=> fK hK c /=; rewrite -[RHS]hK/=; case hcE : (h c) => [b|]//=. +by rewrite -[b in RHS]fK; case: (f b) => //=; have := hK c; rewrite hcE. +Qed. diff -Nru ssreflect-1.14.0/mathcomp/ssreflect/ssrnat.v ssreflect-1.15.0/mathcomp/ssreflect/ssrnat.v --- ssreflect-1.14.0/mathcomp/ssreflect/ssrnat.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/ssreflect/ssrnat.v 2022-06-30 08:50:47.000000000 +0000 @@ -53,6 +53,12 @@ (* the size of the library down. All the inequalities refer to the same *) (* constant "leq"; in particular m < n is identical to m.+1 <= n. *) (* *) +(* -> patterns for contextual rewriting: *) +(* leqLHS := (X in (X <= _)%N)%pattern *) +(* leqRHS := (X in (_ <= X)%N)%pattern *) +(* ltnLHS := (X in (X < _)%N)%pattern *) +(* ltnRHS := (X in (_ < X)%N)%pattern *) +(* *) (* conditionally strict inequality `leqif' *) (* m <= n ?= iff condition == (m <= n) and ((m == n) = condition) *) (* This is actually a pair of boolean equalities, so rewriting with an *) @@ -111,7 +117,7 @@ (* Disable Coq prelude hints to improve proof script robustness. *) -Remove Hints plus_n_O plus_n_Sm mult_n_O mult_n_Sm : core. +#[global] Remove Hints plus_n_O plus_n_Sm mult_n_O mult_n_Sm : core. (* Declare legacy Arith operators in new scope. *) @@ -328,11 +334,11 @@ Lemma ltn0Sn n : 0 < n.+1. Proof. by []. Qed. Lemma ltn0 n : n < 0 = false. Proof. by []. Qed. Lemma leqnn n : n <= n. Proof. by elim: n. Qed. -Hint Resolve leqnn : core. +#[global] Hint Resolve leqnn : core. Lemma ltnSn n : n < n.+1. Proof. by []. Qed. Lemma eq_leq m n : m = n -> m <= n. Proof. by move->. Qed. Lemma leqnSn n : n <= n.+1. Proof. by elim: n. Qed. -Hint Resolve leqnSn : core. +#[global] Hint Resolve leqnSn : core. Lemma leq_pred n : n.-1 <= n. Proof. by case: n => /=. Qed. Lemma leqSpred n : n <= n.-1.+1. Proof. by case: n => /=. Qed. @@ -362,7 +368,7 @@ Lemma lt0n_neq0 n : 0 < n -> n != 0. Proof. by case: n. Qed. Lemma eqn0Ngt n : (n == 0) = ~~ (n > 0). Proof. by case: n. Qed. Lemma neq0_lt0n n : (n == 0) = false -> 0 < n. Proof. by case: n. Qed. -Hint Resolve lt0n_neq0 neq0_lt0n : core. +#[global] Hint Resolve lt0n_neq0 neq0_lt0n : core. Lemma eqn_leq m n : (m == n) = (m <= n <= m). Proof. by elim: m n => [|m IHm] []. Qed. @@ -399,7 +405,7 @@ Lemma ltnW m n : m < n -> m <= n. Proof. exact: leq_trans. Qed. -Hint Resolve ltnW : core. +#[global] Hint Resolve ltnW : core. Lemma leqW m n : m <= n -> m <= n.+1. Proof. by move=> le_mn; apply: ltnW. Qed. @@ -856,6 +862,11 @@ by have [le_nm|/eqnP-> //] := leqP; rewrite -{1}(subnK le_nm) -addSn addnK. Qed. +Notation leqLHS := (X in (X <= _)%N)%pattern. +Notation leqRHS := (X in (_ <= X)%N)%pattern. +Notation ltnLHS := (X in (X < _)%N)%pattern. +Notation ltnRHS := (X in (_ < X)%N)%pattern. + (* Getting a concrete value from an abstract existence proof. *) Section ExMinn. @@ -1106,7 +1117,7 @@ Arguments ltn_pmul2r [m n1 n2]. Lemma ltn_Pmull m n : 1 < n -> 0 < m -> m < n * m. -Proof. by move=> lt1n m_gt0; rewrite -[m in m < _]mul1n ltn_pmul2r. Qed. +Proof. by move=> lt1n m_gt0; rewrite -[ltnLHS]mul1n ltn_pmul2r. Qed. Lemma ltn_Pmulr m n : 1 < n -> 0 < m -> m < m * n. Proof. by move=> lt1n m_gt0; rewrite mulnC ltn_Pmull. Qed. @@ -1400,6 +1411,13 @@ Lemma half_leq m n : m <= n -> m./2 <= n./2. Proof. by move/subnK <-; rewrite halfD addnA leq_addl. Qed. +Lemma geq_half_double m n : (m <= n./2) = (m.*2 <= n). +Proof. +rewrite -[X in _.*2 <= X]odd_double_half. +case: odd; last by rewrite leq_double. +by case: m => // m; rewrite doubleS ltnS ltn_double. +Qed. + Lemma half_gt0 n : (0 < n./2) = (1 < n). Proof. by case: n => [|[]]. Qed. @@ -1409,6 +1427,12 @@ by do 2 case: odd; apply: leq_addl. Qed. +Lemma leq_uphalf_double m n : (uphalf m <= n) = (m <= n.*2). +Proof. +rewrite -[X in X <= _.*2]odd_double_half uphalf_half. +by case: odd; [rewrite !add1n ltn_double | rewrite leq_double]. +Qed. + Lemma uphalf_gt0 n : (0 < uphalf n) = (0 < n). Proof. by case: n. Qed. @@ -2003,27 +2027,3 @@ apply: (congr1 (addn X1) _); symmetry end ]. - -(* Temporary backward compatibility. *) -#[deprecated(since="mathcomp 1.11.0", note="Use oddD instead.")] -Notation odd_add := oddD (only parsing). -#[deprecated(since="mathcomp 1.11.0", note="Use oddB instead.")] -Notation odd_sub := oddB (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use iterD instead.")] -Notation iter_add := iterD (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use maxnMr instead.")] -Notation maxn_mulr := maxnMr (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use maxnMl instead.")] -Notation maxn_mull := maxnMl (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use minnMr instead.")] -Notation minn_mulr := minnMr (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use minnMl instead.")] -Notation minn_mull := minnMl (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use oddN instead.")] -Notation odd_opp := oddN (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use oddM instead.")] -Notation odd_mul := oddM (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use oddX instead.")] -Notation odd_exp := oddX (only parsing). -#[deprecated(since="mathcomp 1.12.0", note="Use sqrnB instead.")] -Notation sqrn_sub := sqrnB (only parsing). diff -Nru ssreflect-1.14.0/mathcomp/ssreflect/tuple.v ssreflect-1.15.0/mathcomp/ssreflect/tuple.v --- ssreflect-1.14.0/mathcomp/ssreflect/tuple.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/ssreflect/tuple.v 2022-06-30 08:50:47.000000000 +0000 @@ -103,7 +103,7 @@ (at level 2, format "n .-tuple") : type_scope. Notation "{ 'tuple' n 'of' T }" := (n.-tuple T : predArgType) - (at level 0, only parsing) : form_scope. + (at level 0, only parsing) : type_scope. Notation "[ 'tuple' 'of' s ]" := (tuple (fun sP => @Tuple _ _ s sP)) (at level 0, format "[ 'tuple' 'of' s ]") : form_scope. @@ -334,6 +334,15 @@ by exists (Ordinal lt_i); rewrite (tnth_nth x) nth_index. Qed. +Lemma tuple_uniqP (t : n.-tuple T) : reflect (injective (tnth t)) (uniq t). +Proof. +case: {+}n => [|m] in t *; first by rewrite tuple0; constructor => -[]. +pose x0 := tnth t ord0; apply/(equivP (uniqP x0)); split=> tinj i j. + by rewrite !(tnth_nth x0) => /tinj/val_inj; apply; rewrite size_tuple inE. +rewrite !size_tuple !inE => im jm; have := tinj (Ordinal im) (Ordinal jm). +by rewrite !(tnth_nth x0) => /[apply]-[]. +Qed. + End EqTuple. Definition tuple_choiceMixin n (T : choiceType) := @@ -486,7 +495,7 @@ (at level 2, format "n .-bseq") : type_scope. Notation "{ 'bseq' n 'of' T }" := (n.-bseq T : predArgType) - (at level 0, only parsing) : form_scope. + (at level 0, only parsing) : type_scope. Notation "[ 'bseq' 'of' s ]" := (bseq (fun sP => @Bseq _ _ s sP)) (at level 0, format "[ 'bseq' 'of' s ]") : form_scope. @@ -588,7 +597,7 @@ Lemma take_bseqP s : size (take m s) <= n. Proof. -by rewrite size_take (leq_trans _ (size_bseq s)) //; case: ifPn => // /ltnW. +by rewrite size_take_min (leq_trans _ (size_bseq s)) // geq_minr. Qed. Canonical take_bseq s := Bseq (take_bseqP s). @@ -686,7 +695,7 @@ Lemma tagged_tuple_bseq_bij {n T} : bijective (@tagged_tuple_bseq n T). Proof. exact/Bijective/bseq_tagged_tupleK/tagged_tuple_bseqK. Qed. -Hint Resolve bseq_tagged_tuple_bij tagged_tuple_bseq_bij : core. +#[global] Hint Resolve bseq_tagged_tuple_bij tagged_tuple_bseq_bij : core. Definition bseq_finMixin n (T : finType) := CanFinMixin (@bseq_tagged_tupleK n T). diff -Nru ssreflect-1.14.0/mathcomp/test_suite/output.v.out ssreflect-1.15.0/mathcomp/test_suite/output.v.out --- ssreflect-1.14.0/mathcomp/test_suite/output.v.out 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/test_suite/output.v.out 2022-06-30 08:50:47.000000000 +0000 @@ -37,7 +37,7 @@ else exists s : perm_for_finType gT, [/\ s \in A, #[s] = (2 ^ n.-1)%N, - m s = (5%:R)%R, <[s]> \x <[t]> = A + m s = 5%R, <[s]> \x <[t]> = A & exists s0 : perm_for_finType gT, [/\ s0 \in A, #[s0] = 2, m s0 = ((2 ^ n).+1%:R)%R, diff -Nru ssreflect-1.14.0/mathcomp/test_suite/test_rat.v ssreflect-1.15.0/mathcomp/test_suite/test_rat.v --- ssreflect-1.14.0/mathcomp/test_suite/test_rat.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/test_suite/test_rat.v 2022-06-30 08:50:47.000000000 +0000 @@ -13,3 +13,11 @@ Goal (-1)^-1 = -1 :> rat. Proof. reflexivity. Qed. + +Local Open Scope rat_scope. + +Check 12. +Check 3.14. +Check -3.14. +Check 0.5. +Check 0.2. diff -Nru ssreflect-1.14.0/mathcomp/test_suite/test_rat.v.out ssreflect-1.15.0/mathcomp/test_suite/test_rat.v.out --- ssreflect-1.14.0/mathcomp/test_suite/test_rat.v.out 1970-01-01 00:00:00.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/test_suite/test_rat.v.out 2022-06-30 08:50:47.000000000 +0000 @@ -0,0 +1,10 @@ +12 + : rat +3.14 + : rat +-3.14 + : rat +0.5 + : rat +0.2 + : rat diff -Nru ssreflect-1.14.0/mathcomp/test_suite/test_ssrAC.v ssreflect-1.15.0/mathcomp/test_suite/test_ssrAC.v --- ssreflect-1.14.0/mathcomp/test_suite/test_ssrAC.v 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/mathcomp/test_suite/test_ssrAC.v 2022-06-30 08:50:47.000000000 +0000 @@ -97,4 +97,4 @@ time have := (@GRing.mul R).[ACl s]. time rewrite (@GRing.mul R).[ACl s]. Abort. -End Tests. \ No newline at end of file +End Tests. diff -Nru ssreflect-1.14.0/.nix/config.nix ssreflect-1.15.0/.nix/config.nix --- ssreflect-1.14.0/.nix/config.nix 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/.nix/config.nix 2022-06-30 08:50:47.000000000 +0000 @@ -49,18 +49,17 @@ coq.override.version = "master"; bignums.override.version = "master"; paramcoq.override.version = "master"; + coq-elpi.override.version = "coq-master"; + hierarchy-builder.override.version = "coq-master"; + }; + "coq-8.16".coqPackages = common-bundles // { + coq.override.version = "8.16"; + paramcoq.override.version = "v8.16"; + coq-elpi.job = false; mathcomp-analysis.job = false; }; "coq-8.15".coqPackages = common-bundles // { - coq.override.version = "V8.15.0"; - bignums.override.version = "V8.15.0"; - paramcoq.override.version = "v1.1.3+coq8.15"; - coq-elpi.override.version = "v1.12.0"; - hierarchy-builder.override.version = "v1.2.1"; - mathcomp-bigenough.override.version = "1.0.1"; - mathcomp-finmap.override.version = "1.5.1"; - mathcomp-real-closed.override.version = "1.1.2"; - mathcomp-analysis.job = false; + coq.override.version = "8.15"; }; "coq-8.14".coqPackages = common-bundles // { coq.override.version = "8.14"; @@ -68,15 +67,5 @@ "coq-8.13".coqPackages = common-bundles // { coq.override.version = "8.13"; }; - "coq-8.12".coqPackages = common-bundles // { - coq.override.version = "8.12"; - mathcomp-analysis.job = false; - mathcomp-zify.job = false; - }; - "coq-8.11".coqPackages = common-bundles // { - coq.override.version = "8.11"; - mathcomp-analysis.job = false; - mathcomp-zify.job = false; - }; }; } diff -Nru ssreflect-1.14.0/.nix/coq-nix-toolbox.nix ssreflect-1.15.0/.nix/coq-nix-toolbox.nix --- ssreflect-1.14.0/.nix/coq-nix-toolbox.nix 2022-01-19 11:53:27.000000000 +0000 +++ ssreflect-1.15.0/.nix/coq-nix-toolbox.nix 2022-06-30 08:50:47.000000000 +0000 @@ -1 +1 @@ -"ccef60688648484a499d367b1e916e8bd36db789" +"aca83c47b7da99361bff5cb5e6f2dbadbbb97242"