Commit 2024-04-13 10:35 8640948c

View on Github →

feat: add notation for Real.sqrt (#12056) This adds the notation √r for Real.sqrt r. The precedence is such that √x⁻¹ is parsed as √(x⁻¹); not because this is particularly desirable, but because it's the default and the choice doesn't really matter. This is extracted from #7907, which adds a more general nth root typeclass. The idea is to perform all the boring substitutions downstream quickly, so that we can play around with custom elaborators with a much slower rate of code-rot. This PR also won't rot as quickly, as it does not forbid writing x.sqrt as that PR does. While perhaps claiming for Real.sqrt is greedy; it:

  • Is far more common thatn NNReal.sqrt and Nat.sqrt
  • Is far more interesting to mathlib than sqrt on Float
  • Can be overloaded anyway, so this does not prevent downstream code using the notation on their own types.
  • Will be replaced by a more general typeclass in a future PR. Zulip

Estimated changes

modified theorem Real.coe_fib_eq
modified theorem gold_sub_goldConj
modified def goldenConj
modified def goldenRatio
modified theorem Continuous.sqrt
modified theorem ContinuousOn.sqrt
modified theorem Real.abs_le_sqrt
modified theorem Real.coe_sqrt
modified theorem Real.continuous_sqrt
modified theorem Real.div_sqrt
modified theorem Real.le_sqrt'
modified theorem Real.le_sqrt
modified theorem Real.le_sqrt_of_sq_le
modified theorem Real.lt_sq_of_sqrt_lt
modified theorem Real.lt_sqrt
modified theorem Real.lt_sqrt_of_sq_lt
modified theorem Real.mul_self_sqrt
modified theorem Real.nat_sqrt_le_real_sqrt
modified theorem Real.neg_sqrt_le_of_sq_le
modified theorem Real.neg_sqrt_lt_of_sq_lt
modified theorem Real.one_le_sqrt
modified theorem Real.sq_le
modified theorem Real.sq_lt
modified theorem Real.sq_sqrt
modified theorem Real.sqrt_div'
modified theorem Real.sqrt_div
modified theorem Real.sqrt_div_self'
modified theorem Real.sqrt_div_self
modified theorem Real.sqrt_eq_cases
modified theorem Real.sqrt_eq_iff_sq_eq
modified theorem Real.sqrt_eq_one
modified theorem Real.sqrt_eq_zero'
modified theorem Real.sqrt_eq_zero
modified theorem Real.sqrt_inj
modified theorem Real.sqrt_inv
modified theorem Real.sqrt_le_iff
modified theorem Real.sqrt_le_left
modified theorem Real.sqrt_le_one
modified theorem Real.sqrt_le_sqrt
modified theorem Real.sqrt_le_sqrt_iff'
modified theorem Real.sqrt_le_sqrt_iff
modified theorem Real.sqrt_lt'
modified theorem Real.sqrt_lt
modified theorem Real.sqrt_lt_sqrt
modified theorem Real.sqrt_lt_sqrt_iff
modified theorem Real.sqrt_mul'
modified theorem Real.sqrt_mul
modified theorem Real.sqrt_mul_self
modified theorem Real.sqrt_mul_self_eq_abs
modified theorem Real.sqrt_ne_zero'
modified theorem Real.sqrt_ne_zero
modified theorem Real.sqrt_nonneg
modified theorem Real.sqrt_one
modified theorem Real.sqrt_one_add_le
modified theorem Real.sqrt_pos
modified theorem Real.sqrt_sq
modified theorem Real.sqrt_sq_eq_abs
modified theorem Real.sqrt_zero