Documentation

WeightedNetKAT.WeightedSemiring

Weighted semirings #

We introduces weighted versions of nessesaray semiring and order instances with custom notation that mirror the Mathlib definitions almost one-to-one.

The reason for this is to simplify the instantiation of weighted version of already existing structures. One such example is the Tropical semiring which works over ENat. ENat already has instances for (almost) everything we need, however, the existing definitons are (ENat, 0, 1, +, *, ≤) while we need (ENat, ⊤, 0, min, +, ≥). One could create new instances for these that shadow the previous, but suddenly one has to proof goals that look like 0 + 1 ≤ 1 where 0 can be either 0 or and the ones can be 1 or 0 independently and can be either or .

To simplify these, the new notation makes it very clear for the reader to see which is which, and equally as important, makes it easier to simp away the weighted notation and get to the meat of the proof.

Previous versions tried the prior approach; for some instances it took hundreds of lines and much turmoil, and some we deemed too complicated just because of the sheer confusion when mixing semirings.

Instances with this new approach are significantly shorter and lends themselves much more to automation.

class WAdd (α : Type u_1) :
Type u_1

Weighted variant of [Add]

  • wadd : ααα
Instances
    class WMul (α : Type u_1) :
    Type u_1

    Weighted variant of [Mul]

    • wmul : ααα
    Instances
      class WKStar (α : Type u_1) :
      Type u_1

      Weighted variant of [KStar]

      • wkstar : αα

        Weighted variant of [KStar]

      Instances
        class WZero (α : Type u_1) :
        Type u_1

        Weighted variant of [Zero]

        • wzero : α
        Instances
          class WOne (α : Type u_1) :
          Type u_1

          Weighted variant of [One]

          • wone : α
          Instances
            class WLE (α : Type u_1) :
            Type u_1

            Weighted variant of [LE]

            • wle : ααProp
            Instances
              class WLT (α : Type u_1) :
              Type u_1

              Weighted variant of [LT]

              • wlt : ααProp
              Instances

                Weighted variant of [KStar]

                Equations
                Instances For
                  @[reducible, inline]
                  abbrev WKStar.toKStar (α : Type u_1) [WKStar α] :
                  Equations
                  Instances For
                    class WSemiring (α : Type u_1) extends WAdd α, WMul α, WOne α, WZero α :
                    Type u_1

                    Weighted variant of [Semiring]

                    Instances
                      class WPartialOrder (α : Type u_1) extends WLE α, WLT α :
                      Type u_1

                      Weighted variant of [PartialOrder]

                      Instances
                        @[reducible, inline]
                        abbrev WSemiring.toSemiring (α : Type u_1) [WSemiring α] :
                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          @[reducible, inline]
                          abbrev WLE.toLE (α : Type u_1) [WLE α] :
                          LE α
                          Equations
                          Instances For
                            @[reducible, inline]
                            abbrev WLT.toLT (α : Type u_1) [WLT α] :
                            LT α
                            Equations
                            Instances For
                              @[reducible, inline]
                              Equations
                              Instances For
                                @[reducible, inline]
                                abbrev WPartialOrder.toDecidableLE (α : Type u_1) [inst : WPartialOrder α] :
                                Equations
                                Instances For
                                  @[implicit_reducible]
                                  instance instWLTOfWLE {α : Type u_1} [WLE α] :
                                  WLT α
                                  Equations
                                  class WOmegaCompletePartialOrder (α : Type u_1) extends WPartialOrder α :
                                  Type u_1
                                  Instances
                                    theorem WOmegaCompletePartialOrder.wωSup_wle_of_wle {α : Type u_1} [WOmegaCompletePartialOrder α] {f : α} {h : ∀ {a b : }, a bf a f b} {x : α} (i : ) (hi : x f i) :
                                    x wωSup f
                                    @[implicit_reducible]
                                    def instLEOfWLE {α : Type u_1} [WLE α] :
                                    LE α
                                    Equations
                                    Instances For
                                      @[implicit_reducible]
                                      def instLTOfWLT {α : Type u_1} [WLT α] :
                                      LT α
                                      Equations
                                      Instances For
                                        @[reducible, inline]
                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For
                                          Instances
                                            @[implicit_reducible]
                                            Equations
                                            Instances For
                                              @[reducible, inline]
                                              Equations
                                              • =
                                              Instances For
                                                @[reducible, inline]
                                                Equations
                                                • =
                                                Instances For
                                                  def wstarn {α : Type u_1} [WSemiring α] (a : α) :
                                                  α
                                                  Equations
                                                  Instances For
                                                    @[simp]
                                                    theorem wzero_le {α : Type u_1} [WOmegaContinuousNonUnitalSemiring α] {a : α} :
                                                    theorem wadd_le_wadd {α : Type u_1} [WOmegaContinuousNonUnitalSemiring α] {a b c d : α} (hac : a c) (hbd : b d) :
                                                    a b c d
                                                    theorem wmul_le_wmul {α : Type u_1} [WOmegaContinuousNonUnitalSemiring α] {a b c d : α} (hac : a c) (hbd : b d) :
                                                    a b c d
                                                    @[simp]
                                                    theorem wstarn_zero {α : Type u_1} [WOmegaContinuousNonUnitalSemiring α] {a : α} :
                                                    theorem wstarn_mono_left {α : Type u_1} [WOmegaContinuousNonUnitalSemiring α] {a b : α} {n : } (h : a b) :
                                                    wstarn a n wstarn b n
                                                    theorem wstarn_le_succ {α : Type u_1} [WOmegaContinuousNonUnitalSemiring α] {a : α} {n : } :
                                                    wstarn a n wstarn a (n + 1)
                                                    theorem wstarn_mono_right {α : Type u_1} [WOmegaContinuousNonUnitalSemiring α] {a : α} {n m : } (h : n m) :
                                                    wstarn a n wstarn a m
                                                    Instances
                                                      @[implicit_reducible]
                                                      Equations
                                                      Instances For
                                                        @[implicit_reducible]
                                                        def instKStarOfWKStar {α : Type u_1} [WKStar α] :
                                                        Equations
                                                        Instances For
                                                          @[reducible, inline]
                                                          Equations
                                                          • =
                                                          Instances For
                                                            @[reducible, inline]
                                                            Equations
                                                            • =
                                                            Instances For