Commit 2024-01-13 13:48 cc7c881a

View on Github →

refactor: Multiplicativise abs (#9553) The current design for abs is flawed:

  • The Abs notation typeclass has exactly two instances: one for [Neg α] [Sup α], one for [Inv α] [Sup α]. This means that:
    • We can't write a meaningful hover for Abs.abs
    • Fields have two Abs instances!
  • We have the multiplicative definition but:
    • All the lemmas in Algebra.Order.Group.Abs are about the additive version.
    • The only lemmas about the multiplicative version are in Algebra.Order.Group.PosPart, and they get additivised to duplicates of the lemmas in Algebra.Order.Group.Abs! This PR changes the notation typeclass with two new definitions (related through to_additive): mabs and abs. abs inherits the |a| notation and mabs gets |a|ₘ instead. The first half of Algebra.Order.Group.Abs gets multiplicativised. A later PR will multiplicativise the second half, and another one will deduplicate the lemmas in Algebra.Order.Group.PosPart. Part of #9411.

Estimated changes

added def abs.unexpander
deleted theorem abs_abs
deleted theorem abs_by_cases
deleted theorem abs_choice
deleted theorem abs_eq_abs
deleted theorem abs_eq_max_neg
deleted theorem abs_eq_sup_inv
deleted theorem abs_eq_zero
deleted theorem abs_le'
deleted theorem abs_le_abs
deleted theorem abs_le_abs_of_nonneg
deleted theorem abs_le_abs_of_nonpos
deleted theorem abs_lt
deleted theorem abs_neg
deleted theorem abs_nonneg
deleted theorem abs_nonpos_iff
deleted theorem abs_of_neg
deleted theorem abs_of_nonneg
deleted theorem abs_of_nonpos
deleted theorem abs_of_pos
deleted theorem abs_pos
deleted theorem abs_pos_of_neg
deleted theorem abs_pos_of_pos
deleted theorem abs_sub_comm
deleted theorem abs_zero
deleted theorem add_abs_nonneg
deleted theorem eq_or_eq_neg_of_abs_eq
added theorem inv_le_mabs
added theorem inv_lt_of_mabs_lt
added theorem inv_mabs_le
added theorem inv_mabs_le_inv
deleted theorem le_abs
deleted theorem le_abs_self
added theorem le_mabs
added theorem le_mabs_self
deleted theorem lt_abs
added theorem lt_mabs
deleted theorem lt_of_abs_lt
added theorem lt_of_mabs_lt
added def mabs.unexpander
added def mabs
added theorem mabs_by_cases
added theorem mabs_choice
added theorem mabs_div_comm
added theorem mabs_eq_mabs
added theorem mabs_eq_max_inv
added theorem mabs_eq_one
added theorem mabs_inv
added theorem mabs_le'
added theorem mabs_le_mabs
added theorem mabs_le_mabs_of_le_one
added theorem mabs_le_mabs_of_one_le
added theorem mabs_le_one
added theorem mabs_lt
added theorem mabs_mabs
added theorem mabs_mabs_div_mabs_le
added theorem mabs_mul_le
added theorem mabs_ne_one
added theorem mabs_of_le_one
added theorem mabs_of_lt_one
added theorem mabs_of_one_le
added theorem mabs_of_one_lt
added theorem mabs_one
added theorem max_div_min_eq_mabs'
added theorem max_div_min_eq_mabs
deleted theorem max_sub_min_eq_abs'
deleted theorem max_sub_min_eq_abs
deleted theorem neg_abs_le_neg
deleted theorem neg_abs_le_self
deleted theorem neg_le_abs_self
deleted theorem neg_lt_of_abs_lt
added theorem one_le_mabs
added theorem one_le_mul_mabs
added theorem one_lt_mabs
added theorem one_lt_mabs_of_lt_one