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.

Instances For
    @[reducible, inline]

    Identity, turning Coeffs into List Int.

    Instances For
      @[reducible, inline]

      Identity, turning List Int into Coeffs.

      Instances For
        @[reducible, inline]

        Are the coefficients all zero?

        Instances For
          @[reducible, inline]
          abbrev Lean.Omega.Coeffs.set (xs : Coeffs) (i : Nat) (y : Int) :

          Shim for IntList.set.

          Instances For
            @[reducible, inline]
            abbrev Lean.Omega.Coeffs.get (xs : Coeffs) (i : Nat) :

            Shim for IntList.get.

            Instances For
              @[reducible, inline]

              Shim for IntList.gcd.

              Instances For
                @[reducible, inline]

                Shim for IntList.smul.

                Instances For
                  @[reducible, inline]

                  Shim for IntList.sdiv.

                  Instances For
                    @[reducible, inline]
                    abbrev Lean.Omega.Coeffs.dot (xs ys : Coeffs) :

                    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]
                            abbrev Lean.Omega.Coeffs.combo (a : Int) (xs : Coeffs) (b : Int) (ys : Coeffs) :

                            Shim for IntList.combo.

                            Instances For
                              @[reducible, inline]

                              Shim for List.length.

                              Instances For
                                @[reducible, inline]

                                Shim for IntList.leading.

                                Instances For
                                  @[reducible, inline]
                                  abbrev Lean.Omega.Coeffs.map (f : IntInt) (xs : Coeffs) :

                                  Shim for List.map.

                                  Instances For
                                    @[reducible, inline]

                                    Shim for .enum.find?.

                                    Instances For
                                      @[reducible, inline]

                                      Shim for IntList.bmod.

                                      Instances For
                                        @[reducible, inline]

                                        Shim for IntList.bmod_dot_sub_dot_bmod.

                                        Instances For
                                          theorem Lean.Omega.Coeffs.get_of_length_le {i : Nat} {xs : Coeffs} (h : xs.length i) :
                                          xs.get i = 0
                                          theorem Lean.Omega.Coeffs.dot_set_left (xs ys : 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 : Coeffs) {d : Int} (h : d xs.gcd) :
                                          (xs.sdiv d).dot ys = xs.dot ys / d
                                          theorem Lean.Omega.Coeffs.dot_smul_left (xs ys : Coeffs) (i : Int) :
                                          dot (i * xs) ys = i * xs.dot ys
                                          theorem Lean.Omega.Coeffs.dot_distrib_left (xs ys zs : Coeffs) :
                                          (xs + ys).dot zs = xs.dot zs + ys.dot zs
                                          theorem Lean.Omega.Coeffs.sub_eq_add_neg (xs ys : Coeffs) :
                                          xs - ys = xs + -ys
                                          theorem Lean.Omega.Coeffs.combo_eq_smul_add_smul (a : Int) (xs : Coeffs) (b : Int) (ys : Coeffs) :
                                          combo a xs b ys = a * xs + b * ys
                                          theorem Lean.Omega.Coeffs.map_length {f : IntInt} {xs : Coeffs} :
                                          (map f xs).length xs.length
                                          theorem Lean.Omega.Coeffs.dot_neg_left (xs ys : IntList) :
                                          dot (-xs) ys = -dot xs ys