Commit 2021-08-17 18:30 90fc0641
View on Github →chore(algebra/associated): use more dot notation (#8556)
I was getting annoyed that working with definitions such as irreducible, prime and associated, I had to write quite verbose terms like dvd_symm_of_irreducible (irreducible_of_prime (prime_of_factor _ hp)) (irreducible_of_prime (prime_of_factor _ hq)) hdvd, where a lot of redundancy can be eliminated with dot notation: (prime_of_factor _ hp).irreducible.dvd_symm (prime_of_factor _ hq).irreducible hdvd. This PR changes the spelling of many of the lemmas in algebra/associated.lean to make usage of dot notation easier. It also adds a few shortcut lemmas that address common patterns.
Since this change touches a lot of files, I'll add a RFC label / open a thread on Zulip to see what everyone thinks.
Renamings:
irreducible_of_prime→prime.irreducibledvd_symm_of_irreducible→irreducible.dvd_symmdvd_symm_iff_of_irreducible→irreducible.dvd_comm(cf.eq.symmversuseq_comm)associated_mul_mul→associated.mul_mulassociated_pow_pow→associated.pow_powdvd_of_associated→associated.dvddvd_dvd_of_associated→associated.dvd_dvddvd_iff_dvd_of_rel_{left,right}→associated.dvd_iff_dvd_{left,right}{eq,ne}_zero_iff_of_associated→associated.{eq,ne}_zero_iff{irreducible,prime}_of_associated→associated.{irreducible,prime}{irreducible,is_unit,prime}_iff_of_associated→associated.{irreducible,is_unit,prime}_iffassociated_of_{irreducible,prime}_of_dvd→{irreducible,prime}.associated_of_dvdgcd_eq_of_associated_{left,right}→associated.gcd_eq_{left,right}{irreducible,prime}_of_degree_eq_one_of_monic→monic.{irreducible,prime}_of_degree_eq_onegcd_monoid.prime_of_irreducible→irreducible.prime(since the GCD case is probably the only case we care about for this implication. And we could generalize to Schreier domains if not) Additions:associated.is_unit := (associated.is_unit_iff _).mp(to matchassociated.primeandassociated.irreducible)associated.mul_left := associated.mul_mul (associated.refl _) _associated.mul_right := associated.mul_mul _ (associated.refl _)Other changes:associated_normalize,normalize_associated,associates.mk_normalize,normalize_apply,prime_X_sub_C: make their final parameter explicit, since it is only inferrable when trying to apply these lemmas. This change helped to golf a few proofs from tactic mode to term mode.- slight golfing and style fixes