Documentation

Mathlib.Algebra.QuadraticAlgebra.Defs

Quadratic Algebra #

In this file we define the quadratic algebra QuadraticAlgebra R a b over a commutative ring R, and define some algebraic structures on it.

Main definitions #

Warning #

If R is a ring, then QuadraticAlgebra a b is an R-algebra, and if R is of characteristic zero then the same holds for QuadraticAlgebra a b. In particular, in the very common case where R is and a and b are such that QuadraticAlgebra a b is a field, then QuadraticAlgebra a b is a -algebra in two ways, that are not definitionally equal. This is a known diamond for characteristic zero fields. If you are working in this setting you should start your file with

attribute [-instance] DivisionRing.toRatAlgebra

to keep the CharZero instance but to avoid having two Algebra instances. (Note that all the basic theorems about QuadraticAlgebra are stated using the general instance Algebra R (QuadraticAlgebra a b), so you don't want to deactivate that one.)

Tags #

Quadratic algebra, quadratic extension

structure QuadraticAlgebra (R : Type u) (a b : R) :

Quadratic algebra over a type with fixed coefficient where $i^2 = a + bi$, implemented as a structure with two fields, re and im. When R is a commutative ring, this is isomorphic to R[X]/(X^2-b*X-a).

  • re : R

    Real part of an element in quadratic algebra

  • im : R

    Imaginary part of an element in quadratic algebra

Instances For
    theorem QuadraticAlgebra.ext {R : Type u} {a b : R} {x y : QuadraticAlgebra R a b} (re : x.re = y.re) (im : x.im = y.im) :
    x = y
    theorem QuadraticAlgebra.ext_iff {R : Type u} {a b : R} {x y : QuadraticAlgebra R a b} :
    x = y x.re = y.re x.im = y.im
    def instDecidableEqQuadraticAlgebra.decEq {R✝ : Type u_1} {a✝ b✝ : R✝} [DecidableEq R✝] (x✝ x✝¹ : QuadraticAlgebra R✝ a✝ b✝) :
    Decidable (x✝ = x✝¹)
    Equations
      Instances For
        instance instDecidableEqQuadraticAlgebra {R✝ : Type u_1} {a✝ b✝ : R✝} [DecidableEq R✝] :
        DecidableEq (QuadraticAlgebra R✝ a✝ b✝)
        Equations
          def QuadraticAlgebra.equivProd {R : Type u_1} (a b : R) :

          The equivalence between quadratic algebra over R and R × R.

          Equations
            Instances For
              @[simp]
              theorem QuadraticAlgebra.equivProd_symm_apply {R : Type u_1} (a b : R) (p : R × R) :
              (equivProd a b).symm p = { re := p.1, im := p.2 }
              @[simp]
              theorem QuadraticAlgebra.mk_eta {R : Type u_1} {a b : R} (z : QuadraticAlgebra R a b) :
              { re := z.re, im := z.im } = z
              def QuadraticAlgebra.C {R : Type u_1} {a b : R} [Zero R] (x : R) :

              The natural function R → QuadraticAlgebra R a b.

              Note that, if R is a ring, you should use algebraMap instead of C.

              Equations
                Instances For
                  @[deprecated QuadraticAlgebra.C (since := "2025-12-15")]
                  def QuadraticAlgebra.coe {R : Type u_1} {a b : R} [Zero R] (x : R) :

                  Alias of QuadraticAlgebra.C.


                  The natural function R → QuadraticAlgebra R a b.

                  Note that, if R is a ring, you should use algebraMap instead of C.

                  Equations
                    Instances For
                      @[simp]
                      theorem QuadraticAlgebra.re_C {R : Type u_1} {a b : R} (r : R) [Zero R] :
                      @[deprecated QuadraticAlgebra.re_C (since := "2025-12-15")]
                      theorem QuadraticAlgebra.re_coe {R : Type u_1} {a b : R} (r : R) [Zero R] :

                      Alias of QuadraticAlgebra.re_C.

                      @[simp]
                      theorem QuadraticAlgebra.im_C {R : Type u_1} {a b : R} (r : R) [Zero R] :
                      @[deprecated QuadraticAlgebra.im_C (since := "2025-12-15")]
                      theorem QuadraticAlgebra.im_coe {R : Type u_1} {a b : R} (r : R) [Zero R] :

                      Alias of QuadraticAlgebra.im_C.

                      @[deprecated QuadraticAlgebra.C_injective (since := "2025-12-15")]

                      Alias of QuadraticAlgebra.C_injective.

                      @[simp]
                      theorem QuadraticAlgebra.C_inj {R : Type u_1} {a b : R} [Zero R] {x y : R} :
                      @[deprecated QuadraticAlgebra.C_inj (since := "2025-12-15")]
                      theorem QuadraticAlgebra.coe_inj {R : Type u_1} {a b : R} [Zero R] {x y : R} :

                      Alias of QuadraticAlgebra.C_inj.

                      instance QuadraticAlgebra.instZero {R : Type u_1} {a b : R} [Zero R] :
                      Equations
                        @[simp]
                        theorem QuadraticAlgebra.re_zero {R : Type u_1} {a b : R} [Zero R] :
                        re 0 = 0
                        @[simp]
                        theorem QuadraticAlgebra.im_zero {R : Type u_1} {a b : R} [Zero R] :
                        im 0 = 0
                        @[simp]
                        theorem QuadraticAlgebra.C_zero {R : Type u_1} {a b : R} [Zero R] :
                        @[deprecated QuadraticAlgebra.C_zero (since := "2025-12-15")]
                        theorem QuadraticAlgebra.coe_zero {R : Type u_1} {a b : R} [Zero R] :

                        Alias of QuadraticAlgebra.C_zero.

                        @[simp]
                        theorem QuadraticAlgebra.C_eq_zero_iff {R : Type u_1} {a b : R} [Zero R] {r : R} :
                        @[deprecated QuadraticAlgebra.C_eq_zero_iff (since := "2025-12-15")]
                        theorem QuadraticAlgebra.coe_eq_zero_iff {R : Type u_1} {a b : R} [Zero R] {r : R} :

                        Alias of QuadraticAlgebra.C_eq_zero_iff.

                        instance QuadraticAlgebra.instInhabited {R : Type u_1} {a b : R} [Zero R] :
                        Equations
                          instance QuadraticAlgebra.instOne {R : Type u_1} {a b : R} [Zero R] [One R] :
                          Equations
                            theorem QuadraticAlgebra.re_one {R : Type u_1} {a b : R} [Zero R] [One R] :
                            re 1 = 1
                            theorem QuadraticAlgebra.im_one {R : Type u_1} {a b : R} [Zero R] [One R] :
                            im 1 = 0
                            @[simp]
                            theorem QuadraticAlgebra.C_one {R : Type u_1} {a b : R} [Zero R] [One R] :
                            @[deprecated QuadraticAlgebra.C_one (since := "2025-12-15")]
                            theorem QuadraticAlgebra.coe_one {R : Type u_1} {a b : R} [Zero R] [One R] :

                            Alias of QuadraticAlgebra.C_one.

                            @[simp]
                            theorem QuadraticAlgebra.C_eq_one_iff {R : Type u_1} {a b : R} [Zero R] [One R] {r : R} :
                            @[deprecated QuadraticAlgebra.C_eq_one_iff (since := "2025-12-15")]
                            theorem QuadraticAlgebra.coe_eq_one_iff {R : Type u_1} {a b : R} [Zero R] [One R] {r : R} :

                            Alias of QuadraticAlgebra.C_eq_one_iff.

                            instance QuadraticAlgebra.instAdd {R : Type u_1} {a b : R} [Add R] :
                            Equations
                              @[simp]
                              theorem QuadraticAlgebra.re_add {R : Type u_1} {a b : R} [Add R] (z w : QuadraticAlgebra R a b) :
                              (z + w).re = z.re + w.re
                              @[simp]
                              theorem QuadraticAlgebra.im_add {R : Type u_1} {a b : R} [Add R] (z w : QuadraticAlgebra R a b) :
                              (z + w).im = z.im + w.im
                              @[simp]
                              theorem QuadraticAlgebra.mk_add_mk {R : Type u_1} {a b : R} [Add R] (z w : QuadraticAlgebra R a b) :
                              { re := z.re, im := z.im } + { re := w.re, im := w.im } = { re := z.re + w.re, im := z.im + w.im }
                              @[deprecated QuadraticAlgebra.C_add (since := "2025-12-15")]

                              Alias of QuadraticAlgebra.C_add.

                              instance QuadraticAlgebra.instNeg {R : Type u_1} {a b : R} [Neg R] :
                              Equations
                                @[simp]
                                theorem QuadraticAlgebra.re_neg {R : Type u_1} {a b : R} [Neg R] (z : QuadraticAlgebra R a b) :
                                (-z).re = -z.re
                                @[simp]
                                theorem QuadraticAlgebra.im_neg {R : Type u_1} {a b : R} [Neg R] (z : QuadraticAlgebra R a b) :
                                (-z).im = -z.im
                                @[simp]
                                theorem QuadraticAlgebra.neg_mk {R : Type u_1} {a b : R} [Neg R] (x y : R) :
                                -{ re := x, im := y } = { re := -x, im := -y }
                                @[deprecated QuadraticAlgebra.C_neg (since := "2025-12-15")]

                                Alias of QuadraticAlgebra.C_neg.

                                instance QuadraticAlgebra.instSub {R : Type u_1} {a b : R} [Sub R] :
                                Equations
                                  @[simp]
                                  theorem QuadraticAlgebra.re_sub {R : Type u_1} {a b : R} [Sub R] (z w : QuadraticAlgebra R a b) :
                                  (z - w).re = z.re - w.re
                                  @[simp]
                                  theorem QuadraticAlgebra.im_sub {R : Type u_1} {a b : R} [Sub R] (z w : QuadraticAlgebra R a b) :
                                  (z - w).im = z.im - w.im
                                  @[simp]
                                  theorem QuadraticAlgebra.mk_sub_mk {R : Type u_1} {a b : R} [Sub R] (x1 y1 x2 y2 : R) :
                                  { re := x1, im := y1 } - { re := x2, im := y2 } = { re := x1 - x2, im := y1 - y2 }
                                  @[deprecated QuadraticAlgebra.C_sub (since := "2025-12-15")]

                                  Alias of QuadraticAlgebra.C_sub.

                                  instance QuadraticAlgebra.instMul {R : Type u_1} {a b : R} [Mul R] [Add R] :
                                  Equations
                                    @[simp]
                                    theorem QuadraticAlgebra.re_mul {R : Type u_1} {a b : R} [Mul R] [Add R] (z w : QuadraticAlgebra R a b) :
                                    (z * w).re = z.re * w.re + a * z.im * w.im
                                    @[simp]
                                    theorem QuadraticAlgebra.im_mul {R : Type u_1} {a b : R} [Mul R] [Add R] (z w : QuadraticAlgebra R a b) :
                                    (z * w).im = z.re * w.im + z.im * w.re + b * z.im * w.im
                                    @[simp]
                                    theorem QuadraticAlgebra.mk_mul_mk {R : Type u_1} {a b : R} [Mul R] [Add R] (x1 y1 x2 y2 : R) :
                                    { re := x1, im := y1 } * { re := x2, im := y2 } = { re := x1 * x2 + a * y1 * y2, im := x1 * y2 + y1 * x2 + b * y1 * y2 }
                                    instance QuadraticAlgebra.instSMul {R : Type u_1} {S : Type u_2} {a b : R} [SMul S R] :
                                    Equations
                                      instance QuadraticAlgebra.instIsScalarTower {R : Type u_1} {S : Type u_2} {T : Type u_3} {a b : R} [SMul S R] [SMul T R] [SMul S T] [IsScalarTower S T R] :
                                      instance QuadraticAlgebra.instSMulCommClass {R : Type u_1} {S : Type u_2} {T : Type u_3} {a b : R} [SMul S R] [SMul T R] [SMulCommClass S T R] :
                                      @[simp]
                                      theorem QuadraticAlgebra.re_smul {R : Type u_1} {S : Type u_2} {a b : R} [SMul S R] (s : S) (z : QuadraticAlgebra R a b) :
                                      (s z).re = s z.re
                                      @[simp]
                                      theorem QuadraticAlgebra.im_smul {R : Type u_1} {S : Type u_2} {a b : R} [SMul S R] (s : S) (z : QuadraticAlgebra R a b) :
                                      (s z).im = s z.im
                                      @[simp]
                                      theorem QuadraticAlgebra.smul_mk {R : Type u_1} {S : Type u_2} {a b : R} [SMul S R] (s : S) (x y : R) :
                                      s { re := x, im := y } = { re := s x, im := s y }
                                      instance QuadraticAlgebra.instMulAction {R : Type u_1} {S : Type u_2} {a b : R} [Monoid S] [MulAction S R] :
                                      Equations
                                        @[simp]
                                        theorem QuadraticAlgebra.C_smul {R : Type u_1} {S : Type u_2} {a b : R} [Zero R] [SMulZeroClass S R] (s : S) (r : R) :
                                        @[deprecated QuadraticAlgebra.C_smul (since := "2025-12-15")]
                                        theorem QuadraticAlgebra.coe_smul {R : Type u_1} {S : Type u_2} {a b : R} [Zero R] [SMulZeroClass S R] (s : S) (r : R) :

                                        Alias of QuadraticAlgebra.C_smul.

                                        instance QuadraticAlgebra.instModule {R : Type u_1} {S : Type u_2} {a b : R} [Semiring S] [AddCommMonoid R] [Module S R] :
                                        Equations
                                          instance QuadraticAlgebra.instAddGroup {R : Type u_1} {a b : R} [AddGroup R] :
                                          Equations
                                            @[deprecated QuadraticAlgebra.C_ofNat (since := "2025-12-15")]

                                            Alias of QuadraticAlgebra.C_ofNat.

                                            @[simp]
                                            theorem QuadraticAlgebra.re_natCast {R : Type u_1} {a b : R} [AddCommMonoidWithOne R] (n : ) :
                                            (↑n).re = n
                                            @[simp]
                                            theorem QuadraticAlgebra.im_natCast {R : Type u_1} {a b : R} [AddCommMonoidWithOne R] (n : ) :
                                            (↑n).im = 0
                                            @[deprecated QuadraticAlgebra.C_natCast (since := "2025-12-15")]
                                            theorem QuadraticAlgebra.coe_natCast {R : Type u_1} {a b : R} [AddCommMonoidWithOne R] (n : ) :

                                            Alias of QuadraticAlgebra.C_natCast.

                                            @[simp]
                                            theorem QuadraticAlgebra.re_intCast {R : Type u_1} {a b : R} [AddCommGroupWithOne R] (n : ) :
                                            (↑n).re = n
                                            @[simp]
                                            theorem QuadraticAlgebra.im_intCast {R : Type u_1} {a b : R} [AddCommGroupWithOne R] (n : ) :
                                            (↑n).im = 0
                                            @[deprecated QuadraticAlgebra.C_intCast (since := "2025-12-15")]
                                            theorem QuadraticAlgebra.coe_intCast {R : Type u_1} {a b : R} [AddCommGroupWithOne R] (n : ) :

                                            Alias of QuadraticAlgebra.C_intCast.

                                            @[deprecated QuadraticAlgebra.C_mul_eq_smul (since := "2025-12-15")]
                                            theorem QuadraticAlgebra.coe_mul_eq_smul {R : Type u_1} {a b : R} [NonUnitalNonAssocSemiring R] (r : R) (x : QuadraticAlgebra R a b) :

                                            Alias of QuadraticAlgebra.C_mul_eq_smul.

                                            @[deprecated QuadraticAlgebra.C_mul (since := "2025-12-15")]

                                            Alias of QuadraticAlgebra.C_mul.

                                            @[simp]
                                            theorem QuadraticAlgebra.nsmul_mk {R : Type u_1} {a b : R} [NonAssocSemiring R] (n : ) (x y : R) :
                                            n * { re := x, im := y } = { re := n * x, im := n * y }
                                            def QuadraticAlgebra.reₗ {R : Type u_1} (a b : R) [Semiring R] :

                                            QuadraticAlgebra.re as a LinearMap

                                            Equations
                                              Instances For
                                                @[simp]
                                                theorem QuadraticAlgebra.reₗ_apply {R : Type u_1} (a b : R) [Semiring R] (self : QuadraticAlgebra R a b) :
                                                (reₗ a b) self = self.re
                                                def QuadraticAlgebra.imₗ {R : Type u_1} (a b : R) [Semiring R] :

                                                QuadraticAlgebra.im as a LinearMap

                                                Equations
                                                  Instances For
                                                    @[simp]
                                                    theorem QuadraticAlgebra.imₗ_apply {R : Type u_1} (a b : R) [Semiring R] (self : QuadraticAlgebra R a b) :
                                                    (imₗ a b) self = self.im
                                                    def QuadraticAlgebra.linearEquivTuple {R : Type u_1} (a b : R) [Semiring R] :

                                                    QuadraticAlgebra.equivTuple as a LinearEquiv

                                                    Equations
                                                      Instances For
                                                        @[simp]
                                                        theorem QuadraticAlgebra.linearEquivTuple_apply {R : Type u_1} (a b : R) [Semiring R] (z : QuadraticAlgebra R a b) :
                                                        @[simp]
                                                        theorem QuadraticAlgebra.linearEquivTuple_symm_apply {R : Type u_1} (a b : R) [Semiring R] (x : Fin 2R) :
                                                        (linearEquivTuple a b).symm x = { re := x 0, im := x 1 }
                                                        noncomputable def QuadraticAlgebra.basis {R : Type u_1} (a b : R) [Semiring R] :

                                                        QuadraticAlgebra R a b has a basis over R given by 1 and i

                                                        Equations
                                                          Instances For
                                                            @[simp]
                                                            theorem QuadraticAlgebra.basis_repr_apply {R : Type u_1} (a b : R) [Semiring R] (x : QuadraticAlgebra R a b) :
                                                            ((basis a b).repr x) = ![x.re, x.im]
                                                            instance QuadraticAlgebra.instAlgebra {R : Type u_1} {S : Type u_2} {a b : R} [CommSemiring R] [CommSemiring S] [Algebra S R] :
                                                            Equations
                                                              theorem QuadraticAlgebra.algebraMap_eq {R : Type u_1} {a b : R} [CommSemiring R] (r : R) :
                                                              (algebraMap R (QuadraticAlgebra R a b)) r = { re := r, im := 0 }
                                                              @[simp]
                                                              theorem QuadraticAlgebra.algebraMap_inj {R : Type u_1} {a b : R} [CommSemiring R] {x y : R} :
                                                              (algebraMap R (QuadraticAlgebra R a b)) x = (algebraMap R (QuadraticAlgebra R a b)) y x = y
                                                              @[simp]
                                                              theorem QuadraticAlgebra.algebraMap_re {R : Type u_1} {a b : R} (r : R) [CommSemiring R] :
                                                              ((algebraMap R (QuadraticAlgebra R a b)) r).re = r
                                                              @[simp]
                                                              theorem QuadraticAlgebra.algebraMap_im {R : Type u_1} {a b : R} (r : R) [CommSemiring R] :
                                                              ((algebraMap R (QuadraticAlgebra R a b)) r).im = 0
                                                              @[simp]
                                                              theorem QuadraticAlgebra.C_pow {R : Type u_1} {a b : R} [CommSemiring R] (n : ) (r : R) :
                                                              @[deprecated QuadraticAlgebra.C_pow (since := "2025-12-15")]
                                                              theorem QuadraticAlgebra.coe_pow {R : Type u_1} {a b : R} [CommSemiring R] (n : ) (r : R) :

                                                              Alias of QuadraticAlgebra.C_pow.

                                                              theorem QuadraticAlgebra.mul_C_eq_smul {R : Type u_1} {a b : R} [CommSemiring R] (r : R) (x : QuadraticAlgebra R a b) :
                                                              @[deprecated QuadraticAlgebra.mul_C_eq_smul (since := "2025-12-15")]
                                                              theorem QuadraticAlgebra.mul_coe_eq_smul {R : Type u_1} {a b : R} [CommSemiring R] (r : R) (x : QuadraticAlgebra R a b) :

                                                              Alias of QuadraticAlgebra.mul_C_eq_smul.

                                                              @[deprecated QuadraticAlgebra.C_eq_algebraMap (since := "2025-12-15")]

                                                              Alias of QuadraticAlgebra.C_eq_algebraMap.

                                                              theorem QuadraticAlgebra.smul_C {R : Type u_1} {a b : R} [CommSemiring R] (r1 r2 : R) :
                                                              @[deprecated QuadraticAlgebra.smul_C (since := "2025-12-15")]
                                                              theorem QuadraticAlgebra.smul_coe {R : Type u_1} {a b : R} [CommSemiring R] (r1 r2 : R) :

                                                              Alias of QuadraticAlgebra.smul_C.

                                                              theorem QuadraticAlgebra.algebraMap_dvd_iff {R : Type u_1} {a b : R} [CommSemiring R] {r : R} {z : QuadraticAlgebra R a b} :
                                                              (algebraMap R (QuadraticAlgebra R a b)) r z r z.re r z.im
                                                              @[deprecated QuadraticAlgebra.algebraMap_dvd_iff (since := "2025-12-15")]
                                                              theorem QuadraticAlgebra.coe_dvd_iff {R : Type u_1} {a b : R} [CommSemiring R] {r : R} {z : QuadraticAlgebra R a b} :
                                                              (algebraMap R (QuadraticAlgebra R a b)) r z r z.re r z.im

                                                              Alias of QuadraticAlgebra.algebraMap_dvd_iff.

                                                              @[simp]
                                                              theorem QuadraticAlgebra.algebraMap_dvd_iff_dvd {R : Type u_1} {a b : R} [CommSemiring R] {z w : R} :
                                                              @[deprecated QuadraticAlgebra.algebraMap_dvd_iff_dvd (since := "2025-12-15")]
                                                              theorem QuadraticAlgebra.coe_dvd_iff_dvd {R : Type u_1} {a b : R} [CommSemiring R] {z w : R} :

                                                              Alias of QuadraticAlgebra.algebraMap_dvd_iff_dvd.

                                                              instance QuadraticAlgebra.instCommRing {R : Type u_1} {a b : R} [CommRing R] :
                                                              Equations
                                                                @[simp]
                                                                theorem QuadraticAlgebra.zsmul_val {R : Type u_1} {a b : R} [CommRing R] (n : ) (x y : R) :
                                                                n * { re := x, im := y } = { re := n * x, im := n * y }