Documentation

Init.Omega.Coeffs

Coeffs as a wrapper for IntList #

Currently omega uses a dense representation for coefficients. However, we can swap this out for a sparse representation.

This file sets up Coeffs as a type synonym for IntList, and abbreviations for the functions in the IntList namespace which we need to use in the omega algorithm.

There is an equivalent file setting up Coeffs as a type synonym for AssocList Nat Int, currently in a private branch. Not all the theorems about the algebraic operations on that representation have been proved yet. When they are ready, we can replace the implementation in omega simply by importing Init.Omega.IntDict instead of Init.Omega.IntList.

For small problems, the sparse representation is actually slightly slower, so it is not urgent to make this replacement.

@[reducible, inline]

Type synonym for IntList := List Int.

Equations
Instances For
    @[reducible, inline]

    Identity, turning Coeffs into List Int.

    Equations
    • xs.toList = xs
    Instances For
      @[reducible, inline]

      Identity, turning List Int into Coeffs.

      Equations
      Instances For
        @[reducible, inline]

        Are the coefficients all zero?

        Equations
        • xs.isZero = ∀ (x : Int), x xsx = 0
        Instances For
          @[reducible, inline]

          Shim for IntList.set.

          Equations
          Instances For
            @[reducible, inline]

            Shim for IntList.get.

            Instances For
              @[reducible, inline]

              Shim for IntList.gcd.

              Equations
              Instances For
                @[reducible, inline]

                Shim for IntList.smul.

                Equations
                Instances For
                  @[reducible, inline]

                  Shim for IntList.sdiv.

                  Instances For
                    @[reducible, inline]

                    Shim for IntList.dot.

                    Instances For
                      @[reducible, inline]

                      Shim for IntList.add.

                      Instances For
                        @[reducible, inline]

                        Shim for IntList.sub.

                        Instances For
                          @[reducible, inline]

                          Shim for IntList.neg.

                          Instances For
                            @[reducible, inline]

                            Shim for IntList.combo.

                            Instances For
                              @[reducible, inline]

                              Shim for List.length.

                              Equations
                              Instances For
                                @[reducible, inline]

                                Shim for IntList.leading.

                                Equations
                                Instances For
                                  @[reducible, inline]

                                  Shim for List.map.

                                  Equations
                                  Instances For
                                    @[reducible, inline]

                                    Shim for .enum.find?.

                                    Instances For
                                      @[reducible, inline]

                                      Shim for IntList.bmod.

                                      Equations
                                      Instances For
                                        @[reducible, inline]

                                        Shim for IntList.bmod_dot_sub_dot_bmod.

                                        Instances For
                                          theorem Lean.Omega.Coeffs.bmod_length (x : Lean.Omega.Coeffs) (m : Nat) :
                                          (x.bmod m).length x.length
                                          theorem Lean.Omega.Coeffs.get_of_length_le {i : Nat} {xs : Lean.Omega.Coeffs} (h : xs.length i) :
                                          xs.get i = 0
                                          theorem Lean.Omega.Coeffs.dot_set_left (xs ys : Lean.Omega.Coeffs) (i : Nat) (z : Int) :
                                          (xs.set i z).dot ys = xs.dot ys + (z - xs.get i) * ys.get i
                                          theorem Lean.Omega.Coeffs.dot_sdiv_left (xs ys : Lean.Omega.Coeffs) {d : Int} (h : d xs.gcd) :
                                          (xs.sdiv d).dot ys = xs.dot ys / d
                                          theorem Lean.Omega.Coeffs.dot_distrib_left (xs ys zs : Lean.Omega.Coeffs) :
                                          (xs + ys).dot zs = xs.dot zs + ys.dot zs
                                          theorem Lean.Omega.Coeffs.gcd_dvd_dot_left (xs ys : Lean.Omega.Coeffs) :
                                          xs.gcd xs.dot ys
                                          theorem Lean.Omega.Coeffs.map_length {f : IntInt} {xs : Lean.Omega.Coeffs} :
                                          (Lean.Omega.Coeffs.map f xs).length xs.length