Squares, even and odd elements #
This file proves some general facts about squares, even and odd elements of semirings.
In the implementation, we define is_square
and we let even
be the notion transported by
to_additive
. The definition are therefore as follows:
Odd elements are not unified with a multiplicative notion.
Future work #
- TODO: Try to generalize further the typeclass assumptions on
is_square/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.
An element a
of a type α
with addition satisfies even a
if a = r + r
,
for some r : α
.
Instances for even
Create a decidability instance for is_square
on fintype
s.
Equations
- is_square_decidable = λ (a : α), fintype.decidable_exists_fintype
Alias of the reverse direction of is_square_iff_exists_sq
.
Alias of the forward direction of is_square_iff_exists_sq
.
Alias of the forwards direction of
even_iff_exists_two_nsmul
.
Alias of the backwards direction of
even_iff_exists_two_nsmul
.
0
is always a square (in a monoid with zero).
Alias of the reverse direction of is_square_inv
.
Alias of the reverse direction of is_square_inv
.
Alias of the forward direction of even_iff_exists_bit0
.
An element a
of a semiring is odd if there exists k
such a = 2*k + 1
.
Instances for odd
Alias of the forward direction of odd_iff_exists_bit1
.
The cardinality of fin (bit0 k)
is even, fact
version.
This fact
is needed as an instance by matrix.special_linear_group.has_neg
.