Squares and even elements #
This file defines square and even elements in a monoid.
Main declarations #
IsSquare ameans that there is somersuch thata = r * rEven ameans that there is somersuch thata = r + r
Note #
- Many lemmas about
Even/IsSquare, including importantsimplemmas, are inMathlib/Algebra/Ring/Parity.lean.
TODO #
- Try to generalize
IsSquare/Evenlemmas further. For example, there are still a few lemmas inAlgebra.Ring.ParitywhoseSemiringassumptions I (DT) am not convinced are necessary. - The "old" definition of
Even aasked for the existence of an elementcsuch thata = 2 * c. For this reason, several fixes introduce an extratwo_mulor← two_mul. It might be the case that by making a careful choice ofsimplemma, this can be avoided.
See also #
Mathlib/Algebra/Ring/Parity.lean for the definition of odd elements as well as facts about
Even / IsSquare in rings.
theorem
isSquare_iff_exists_mul_self
{α : Type u_2}
[Mul α]
(a : α)
:
IsSquare a ↔ ∃ (r : α), a = r * r
Alias of the forward direction of isSquare_iff_exists_mul_self.
@[simp]
theorem
isSquare_unop_iff
{α : Type u_2}
[Mul α]
{a : αᵐᵒᵖ}
:
IsSquare (MulOpposite.unop a) ↔ IsSquare a
@[implicit_reducible]
instance
instDecidablePredMulOppositeIsSquare
{α : Type u_2}
[Mul α]
[DecidablePred IsSquare]
:
DecidablePred IsSquare
@[implicit_reducible]
instance
instDecidablePredAddOppositeEven
{α : Type u_2}
[Add α]
[DecidablePred Even]
:
DecidablePred Even
@[simp]
@[simp]
theorem
isSquare_toMul_iff
{α : Type u_2}
[Mul α]
{a : Additive α}
:
IsSquare (Additive.toMul a) ↔ Even a
@[implicit_reducible]
instance
Additive.instDecidablePredEven
{α : Type u_2}
[Mul α]
[DecidablePred IsSquare]
:
DecidablePred Even
@[simp]
theorem
isSquare_ofAdd_iff
{α : Type u_2}
[Add α]
{a : α}
:
IsSquare (Multiplicative.ofAdd a) ↔ Even a
@[simp]
theorem
even_toAdd_iff
{α : Type u_2}
[Add α]
{a : Multiplicative α}
:
Even (Multiplicative.toAdd a) ↔ IsSquare a
@[implicit_reducible]
instance
Multiplicative.instDecidablePredIsSquare
{α : Type u_2}
[Add α]
[DecidablePred Even]
:
DecidablePred IsSquare
theorem
IsSquare.map
{F : Type u_1}
{α : Type u_2}
{β : Type u_3}
[MulOneClass α]
[MulOneClass β]
[FunLike F α β]
[MonoidHomClass F α β]
{a : α}
(f : F)
:
theorem
Even.map
{F : Type u_1}
{α : Type u_2}
{β : Type u_3}
[AddZeroClass α]
[AddZeroClass β]
[FunLike F α β]
[AddMonoidHomClass F α β]
{a : α}
(f : F)
:
theorem
isSquare_subset_image_isSquare
{F : Type u_1}
{α : Type u_2}
{β : Type u_3}
[MulOneClass α]
[MulOneClass β]
[FunLike F α β]
[MonoidHomClass F α β]
{f : F}
(hf : Function.Surjective ⇑f)
:
theorem
even_subset_image_even
{F : Type u_1}
{α : Type u_2}
{β : Type u_3}
[AddZeroClass α]
[AddZeroClass β]
[FunLike F α β]
[AddMonoidHomClass F α β]
{f : F}
(hf : Function.Surjective ⇑f)
:
theorem
even_iff_exists_two_nsmul
{α : Type u_2}
[AddMonoid α]
(a : α)
:
Even a ↔ ∃ (r : α), a = 2 • r
Alias of the forward direction of isSquare_iff_exists_sq.
Alias of the forwards direction of even_iff_exists_two_nsmul.
@[simp]
@[simp]
Alias of the reverse direction of isSquare_inv.
theorem
IsSquare.div
{α : Type u_2}
[DivisionCommMonoid α]
{a b : α}
(ha : IsSquare a)
(hb : IsSquare b)
:
IsSquare (a / b)
@[simp]
@[simp]