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
↔ ∃ r, a = r * r
Even a ↔ ∃ r, a = r + r
∃ r, a = r * r
Even a ↔ ∃ r, a = r + r
↔ ∃ r, a = r + r
∃ 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← two_mul
. It might be the case that by making a careful choice ofsimp
lemma, this can be avoided.
abbrev
even_op_iff.match_1
{α : Type u_1}
[inst : Add α]
(a : α)
(motive : Even { unop := a } → Prop)
:
Equations
- even_op_iff.match_1 a motive x h_1 = Exists.casesOn x fun w h => h_1 w h
Equations
- even_op_iff.match_2 a motive x h_1 = Exists.casesOn x fun w h => h_1 w h
theorem
Even.map
{F : Type u_3}
{α : Type u_1}
{β : Type u_2}
[inst : AddZeroClass α]
[inst : AddZeroClass β]
[inst : AddMonoidHomClass F α β]
{m : α}
(f : F)
:
theorem
IsSquare.map
{F : Type u_3}
{α : Type u_1}
{β : Type u_2}
[inst : MulOneClass α]
[inst : MulOneClass β]
[inst : MonoidHomClass F α β]
{m : α}
(f : F)
:
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
.
@[simp]
Alias of the reverse direction of isSquare_inv
.
theorem
Even.neg_one_zpow
{α : Type u_1}
[inst : DivisionMonoid α]
[inst : HasDistribNeg α]
{n : ℤ}
(h : Even n)
:
theorem
IsSquare.div
{α : Type u_1}
[inst : DivisionCommMonoid α]
{a : α}
{b : α}
(ha : IsSquare a)
(hb : IsSquare b)
:
theorem
Even.tsub
{α : Type u_1}
[inst : CanonicallyLinearOrderedAddMonoid α]
[inst : Sub α]
[inst : OrderedSub α]
[inst : ContravariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1]
{m : α}
{n : α}
(hm : Even m)
(hn : Even n)
:
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
.
theorem
Odd.pos
{α : Type u_1}
[inst : CanonicallyOrderedCommSemiring α]
[inst : Nontrivial α]
{n : α}
(hn : Odd n)
:
0 < n
theorem
Even.pow_pos
{R : Type u_1}
[inst : LinearOrderedRing R]
{a : R}
{n : ℕ}
(hn : Even n)
(ha : a ≠ 0)
:
theorem
Odd.pow_nonpos
{R : Type u_1}
[inst : LinearOrderedRing R]
{a : R}
{n : ℕ}
(hn : Odd n)
(ha : a ≤ 0)
:
theorem
Odd.pow_neg
{R : Type u_1}
[inst : LinearOrderedRing R]
{a : R}
{n : ℕ}
(hn : Odd n)
(ha : a < 0)
:
theorem
Odd.strictMono_pow
{R : Type u_1}
[inst : LinearOrderedRing R]
{n : ℕ}
(hn : Odd n)
:
StrictMono fun a => a ^ n
Simp attribute for lemmas about even
Equations
- One or more equations did not get rendered due to their size.