Squares, even and odd elements #
This file proves some general facts about squares, even and odd elements of semirings.
In the implementation, we define IsSquare
and we let Even
be the notion transported by
to_additive
. The definition are therefore as follows:
IsSquare a ↔ ∃ r, a = r * r
Even a ↔ ∃ r, a = r + r
Odd elements are not unified with a multiplicative notion.
Future work #
- TODO: Try to generalize further the typeclass assumptions on
IsSquare/Even
. For instance, in some cases, there areSemiring
assumptions that I (DT) am not convinced are necessary. - TODO: Consider moving the definition and lemmas about
Odd
to a separate file. - TODO: The "old" definition of
Even a
asked for the existence of an elementc
such thata = 2 * c
. For this reason, several fixes introduce an extratwo_mul
or← two_mul
. It might be the case that by making a careful choice ofsimp
lemma, this can be avoided.
Equations
- ⋯ = ⋯
Instances For
Equations
Equations
Equations
- instDecidablePredAdditiveEvenAdd x = decidable_of_iff (IsSquare (Additive.toMul x)) ⋯
Equations
- instDecidablePredMultiplicativeIsSquareMul x = decidable_of_iff (Even (Multiplicative.toAdd x)) ⋯
Alias of the forward direction of isSquare_iff_exists_sq
.
Alias of the reverse direction of isSquare_iff_exists_sq
.
Alias of the forwards direction of even_iff_exists_two_nsmul
.
Alias of the reverse direction of isSquare_inv
.
Alias of the forward direction of even_iff_exists_bit0
.
Alias of the forward direction of even_iff_two_dvd
.
Alias of the forward direction of odd_iff_exists_bit1
.
Lemmas for canonically linear ordered semirings or linear ordered rings #
The slightly unusual typeclass assumptions [LinearOrderedSemiring R] [ExistsAddOfLE R]
cover two
more familiar settings:
[LinearOrderedRing R]
, egℤ
,ℚ
orℝ
[CanonicallyLinearOrderedSemiring R]
(although we don't actually have this typeclass), egℕ
,ℚ≥0
orℝ≥0
Alias of the reverse direction of Odd.pow_nonpos_iff
.
Alias of the reverse direction of Odd.pow_neg_iff
.