Commit 2022-04-05 11:06 220f71ba
View on Github →refactor(data/polynomial/basic): overhaul all the misnamed to_finsupp lemmas (#13139)
zero_to_finsupp was the statement of_finsupp 0 = 0, which doesn't match the name at all.
This change:
- Renames all those lemmas to
of_finsupp_<foo> - Changes the direction of
add_to_finsuppto beof_finsupp_add, so the statement is nowof_finsupp (a + b) = _ - Adds the missing
to_finsupp_<foo>lemmas - Uses the new lemmas to golf the semiring and ring instances The renames include:
zero_to_finsupp→of_finsupp_zeroone_to_finsupp→of_finsupp_oneadd_to_finsupp→of_finsupp_add(direction reversed)neg_to_finsupp→of_finsupp_neg(direction reversed)mul_to_finsupp→of_finsupp_mul(direction reversed)smul_to_finsupp→of_finsupp_smul(direction reversed)sum_to_finsupp→of_finsupp_sum(direction reversed)to_finsupp_iso_monomial→to_finsupp_monomialto_finsupp_iso_symm_single→of_finsupp_singleeval₂_to_finsupp_eq_lift_nc→eval₂_of_finsuppThe new lemmas include:of_finsupp_subof_finsupp_powof_finsupp_eraseof_finsupp_algebra_mapof_finsupp_eq_zeroof_finsupp_eq_oneto_finsupp_zeroto_finsupp_oneto_finsupp_addto_finsupp_negto_finsupp_subto_finsupp_multo_finsupp_powto_finsupp_eraseto_finsupp_algebra_mapto_finsupp_eq_zeroto_finsupp_eq_oneto_finsupp_CNote that by marking things likesupportandcoeffas@[simp], they behave as if they weresupport_of_finsupporcoeff_of_finsupplemma. By makingcoeffpattern match fewer arguments, we encourage it to apply more keenly. Neither lemma will fire unless our expression containspolynomial.of_finsupp.