Documentation

Linglib.Semantics.Degree.Discrete

Discrete degree carriers #

The finite, Fin-backed scale carriers used by RSA fragments and computational Studies [Ken07] [Hei01] [KMcN05]: Bounded max / Threshold max with their order/Fintype instances, and the threshold-comparison predicates (tall / short / not tall). The abstract theory works with plain measure functions μ : E → D into a preorder (Comparative.lean, Extent.lean); this module is its decidable discretization.

Main definitions #

Discrete bounded scales #

structure Degree.Bounded (max : ) :

A degree on a scale from 0 to max — a discretized continuous value (height, temperature, …).

  • value : Fin (max + 1)
Instances For
    def Degree.instReprBounded.repr {max✝ : } :
    Bounded max✝Std.Format
    Equations
    • Degree.instReprBounded.repr x✝ prec✝ = Std.Format.bracket "{ " (Std.Format.nil ++ Std.Format.text "value" ++ Std.Format.text " := " ++ (Std.Format.nest 9 (repr x✝.value)).group) " }"
    Instances For
      @[implicit_reducible]
      instance Degree.instReprBounded {max✝ : } :
      Repr (Bounded max✝)
      Equations
      @[implicit_reducible]
      instance Degree.instDecidableEqBounded {max✝ : } :
      DecidableEq (Bounded max✝)
      Equations
      def Degree.instDecidableEqBounded.decEq {max✝ : } (x✝ x✝¹ : Bounded max✝) :
      Decidable (x✝ = x✝¹)
      Equations
      Instances For
        @[implicit_reducible]
        instance Degree.instInhabitedBounded {n : } :
        Inhabited (Bounded n)
        Equations
        @[implicit_reducible]
        instance Degree.instLinearOrderBounded {max : } :
        LinearOrder (Bounded max)

        Bounded max inherits a linear order from Fin (max + 1).

        Equations
        @[implicit_reducible]
        instance Degree.instBoundedOrderBounded {max : } :
        BoundedOrder (Bounded max)

        Bounded max is bounded: 0 is the minimum, max the maximum.

        Equations
        def Degree.allDegrees (max : ) :
        List (Bounded max)

        All degrees from 0 to max.

        Equations
        • Degree.allDegrees max = List.map (fun (x : Fin (max + 1)) => { value := x }) (List.finRange (max + 1))
        Instances For
          def Degree.Bounded.ofNat (max n : ) :

          Bounded from Nat (clamped to max).

          Equations
          Instances For
            def Degree.Bounded.toNat {max : } (d : Bounded max) :

            The numeric value of a degree.

            Equations
            Instances For
              structure Degree.Threshold (max : ) :

              A threshold for a gradable adjective: x is "tall" iff degree x > threshold.

              • value : Fin max
              Instances For
                @[implicit_reducible]
                instance Degree.instReprThreshold {max✝ : } :
                Repr (Threshold max✝)
                Equations
                def Degree.instReprThreshold.repr {max✝ : } :
                Threshold max✝Std.Format
                Equations
                • Degree.instReprThreshold.repr x✝ prec✝ = Std.Format.bracket "{ " (Std.Format.nil ++ Std.Format.text "value" ++ Std.Format.text " := " ++ (Std.Format.nest 9 (repr x✝.value)).group) " }"
                Instances For
                  def Degree.instDecidableEqThreshold.decEq {max✝ : } (x✝ x✝¹ : Threshold max✝) :
                  Decidable (x✝ = x✝¹)
                  Equations
                  Instances For
                    @[implicit_reducible]
                    instance Degree.instDecidableEqThreshold {max✝ : } :
                    DecidableEq (Threshold max✝)
                    Equations
                    @[implicit_reducible]
                    instance Degree.instInhabitedThresholdOfNeZeroNat {n : } [NeZero n] :
                    Inhabited (Threshold n)
                    Equations
                    @[implicit_reducible]
                    instance Degree.instLinearOrderThreshold {max : } :
                    LinearOrder (Threshold max)

                    Threshold max inherits a linear order from Fin max.

                    Equations
                    def Degree.allThresholds (max : ) :
                    autoParam (0 < max) allThresholds._auto_1List (Threshold max)

                    All thresholds from 0 to max - 1.

                    Equations
                    Instances For
                      def Degree.Threshold.toNat {max : } (t : Threshold max) :

                      The numeric value of a threshold.

                      Equations
                      Instances For
                        @[implicit_reducible]
                        instance Degree.instFintypeBounded {max : } :
                        Fintype (Bounded max)
                        Equations
                        @[implicit_reducible]
                        instance Degree.instFintypeThresholdOfNeZeroNat {max : } [NeZero max] :
                        Fintype (Threshold max)
                        Equations
                        @[implicit_reducible]
                        instance Degree.instCoeThresholdBounded {max : } :
                        Coe (Threshold max) (Bounded max)

                        Coercion: a Threshold embeds into Bounded via Fin.castSucc.

                        Equations
                        theorem Degree.coe_threshold_toNat {max : } (t : Threshold max) :
                        { value := t.value.castSucc }.toNat = t.toNat
                        @[reducible, inline]
                        abbrev Degree.deg (n : ) {max : } (h : n max := by omega) :

                        Construct a degree by literal: deg 5 : Bounded 10.

                        Equations
                        Instances For
                          @[reducible, inline]
                          abbrev Degree.thr (n : ) {max : } (h : n < max := by omega) :

                          Construct a threshold by literal: thr 5 : Threshold 10.

                          Equations
                          Instances For

                            Threshold-comparison meanings #

                            General degree operations on the discrete carriers, not adjective-specific; decidability is inherited from the underlying Fin order.

                            def Degree.positiveMeaning {max : } (d : Bounded max) (t : Threshold max) :

                            Positive form (tall): t < d — the strict threshold face of Core.Order.Comparison.gt.over on the discrete carrier.

                            Equations
                            Instances For
                              def Degree.negativeMeaning {max : } (d : Bounded max) (t : Threshold max) :

                              Polar antonym (short): d < t, evaluated against the antonym's own threshold (which may sit below the positive's — see Gradability.ThresholdPair).

                              Equations
                              Instances For
                                def Degree.notPositiveMeaning {max : } (d : Bounded max) (t : Threshold max) :

                                Contradictory negation (not tall): d ≤ t, the complement of positiveMeaning. Not the polar antonym — that is negativeMeaning.

                                Equations
                                Instances For
                                  @[implicit_reducible]
                                  instance Degree.instDecidablePositiveMeaning {max : } (d : Bounded max) (t : Threshold max) :
                                  Decidable (positiveMeaning d t)
                                  Equations
                                  @[implicit_reducible]
                                  instance Degree.instDecidableNegativeMeaning {max : } (d : Bounded max) (t : Threshold max) :
                                  Decidable (negativeMeaning d t)
                                  Equations