Documentation

Grip.Modality

Grip.Modality: the three-valued modality #

never < possibly < always, the truth values of the grip parser grade algebra. Batteries-only: no mathlib. Join and meet are the core Max/Min classes (max/min); grip deliberately does not declare Sup/Inf, so grip-props can import mathlib (which declares those) without a duplicate-declaration clash.

inductive Modality :

Three-valued modality tracking whether a property holds always, possibly, or never. The order is neverpossiblyalways.

Instances For
    @[instance_reducible]
    Equations
    Equations
    Instances For
      @[instance_reducible]
      Equations
      @[reducible]

      Supremum on Modality: the join in never < possibly < always. max a b = a when a is the greater element.

      Reducible so that a grade product of named grades (conditional * conditional, ...) still reduces under instances transparency, which is what dsimp/rw type-check goals at since Lean v4.31.

      Equations
      Instances For

        Infimum on Modality: the meet in never < possibly < always.

        Equations
        Instances For
          @[instance_reducible]
          Equations
          @[instance_reducible]
          Equations

          Order relation: neverpossiblyalways.

          Equations
          Instances For
            @[instance_reducible]
            Equations
            @[instance_reducible]
            Equations
            def Modality.ite (sel a b : Modality) :

            Conditional selection driven by sel : Modality.

            • always.ite a b = a (first branch wins)
            • never.ite a b = b (second branch wins)
            • possibly.ite a b = a when a = b, otherwise possibly (conservative)
            Equations
            Instances For
              @[simp]
              theorem Modality.ite_always (a b : Modality) :
              always.ite a b = a
              @[simp]
              theorem Modality.ite_never (a b : Modality) :
              never.ite a b = b
              @[simp]
              @[simp]

              never is the left identity for join.

              @[simp]

              never is the right identity for join.

              @[simp]

              always absorbs on the left for join.

              @[simp]

              always absorbs on the right for join.

              @[simp]

              A join equals always iff at least one operand is always.

              @[simp]

              A join equals never iff both operands are never.

              @[simp]

              A meet equals never iff at least one operand is never.

              @[simp]

              A meet equals always iff both operands are always.

              theorem Modality.sup_comm (a b : Modality) :
              max a b = max b a

              Join is commutative.

              If a ≠ never then possibly ≤ a.