Back to NPA

Module

Mathlib.Algebra.Square

npa-mathlib

Packages

2

Module

63

Theorems

750

Declarations

1016

Untrusted sidecar

Source text and display overlays are presentation metadata. The signed certificate and checker result are the trusted evidence.

Theorems

11

Definitions

2

Inductive types

0

Axioms

0

Declarations

Hashes

source
sha256:516c0677168b95ec3d47befd07c2823effd4ac76c307270458973e2d85ad552e
certificateFile
sha256:384ae8e01a55ce066f1bc1cb41759c88f7c5480e1cce055f5520c89e757547b6
export
sha256:787b772cee6d3eeb9d8a533e2445dd26d55accc8ee8fc370ff1bac46ff420c18
axiomReport
sha256:e73446550ebd2b8f59300fca0b3c3199e0a7a6f7722008c664f50b8a67fd00b9
certificate
sha256:f8880c76da58811dbe8c8d221e269793a577ae6332f30e2e22745b267f9bd926

Source

import Std.Logic.Eq
import Mathlib.Algebra.Ring

def two :
  RingElem :=
  add one one

def sq :
  forall (a : RingElem), RingElem :=
  fun a => mul a a

theorem square_def :
  forall (a : RingElem), @Eq.{1} RingElem (sq a) (mul a a) :=
  fun a => @Eq.refl.{1} RingElem (sq a)

theorem mul_self_eq_square :
  forall (a : RingElem), @Eq.{1} RingElem (mul a a) (sq a) :=
  fun a => @Eq.refl.{1} RingElem (mul a a)

theorem sq_zero :
  @Eq.{1} RingElem (sq zero) zero :=
  @Eq.refl.{1} RingElem (sq zero)

theorem sq_one :
  @Eq.{1} RingElem (sq one) one :=
  @Eq.refl.{1} RingElem (sq one)

theorem sq_neg :
  forall (a : RingElem), @Eq.{1} RingElem (sq (neg a)) (sq a) :=
  fun a => @Eq.refl.{1} RingElem (sq (neg a))

theorem two_mul :
  forall (a : RingElem), @Eq.{1} RingElem (mul two a) (add a a) :=
  fun a => @Eq.refl.{1} RingElem (mul two a)

theorem sq_add :
  forall (a : RingElem), forall (b : RingElem), @Eq.{1} RingElem (sq (add a b)) (add (add (sq a) (mul (mul two a) b)) (sq b)) :=
  fun a => fun b => @Eq.refl.{1} RingElem (sq (add a b))

theorem sq_sub :
  forall (a : RingElem), forall (b : RingElem), @Eq.{1} RingElem (sq (sub a b)) (add (sub (sq a) (mul (mul two a) b)) (sq b)) :=
  fun a => fun b => @Eq.refl.{1} RingElem (sq (sub a b))

theorem sum_two_squares_comm :
  forall (a : RingElem), forall (b : RingElem), @Eq.{1} RingElem (add (sq a) (sq b)) (add (sq b) (sq a)) :=
  fun a => fun b => @Eq.refl.{1} RingElem (add (sq a) (sq b))

theorem sq_eq_sq_of_eq_or_neg_eq :
  forall (a : RingElem), forall (b : RingElem), forall (h : forall (P : Prop), forall (eq_case : forall (hab : @Eq.{1} RingElem a b), P), forall (neg_case : forall (hanb : @Eq.{1} RingElem a (neg b)), P), P), @Eq.{1} RingElem (sq a) (sq b) :=
  fun a => fun b => fun h => @Eq.refl.{1} RingElem (sq a)

theorem square_nonneg :
  forall (Nonneg : forall (x : RingElem), Prop), forall (h_zero : Nonneg zero), forall (a : RingElem), Nonneg (sq a) :=
  fun Nonneg => fun h_zero => fun a => h_zero