Documentation

Linglib.Core.Logic.Trivalent.Basic

Three-valued truth #

Trivalent is the three-element bounded chain false < indet < true: the value space of strong Kleene logic ([Kle52]), the bilattice literature's THREE ([Fit94]), and the consistent fragment of Belnap's FOUR. Strong Kleene conjunction and disjunction are the chain's /; the carrier is logic-neutral, hosting the rival trivalent connective families — Weak Kleene ([Boc37]), Middle Kleene ([Pet79]), Belnap conditional assertion ([Bel70]) — and the partiality operators ∂ and 𝒜 of [BK01].

The upstreamable algebra is the Order.KleeneAlgebra class (Core/Order/DeMorganAlgebra/Defs.lean), of which Trivalent is the canonical non-Boolean instance. The dedicated carrier with truth-named constructors is this library's ergonomic choice; the name follows the Boolean precedent — an adjective nominalized as its truth-value type — with the Trivalent namespace hosting the whole trivalent development (this file's algebra, Core/ModelTheory/Trivalent.lean's formulas).

Main definitions #

Main results #

References #

[Kle52] [Boc37] [Bel70] [Pet79] [BK01] [CERvR12] [WD26]

inductive Trivalent :

Three-valued truth: the 3-element bounded chain false < indet < true. Strong Kleene logic ([Kle52]) corresponds to the order-derived operations: conjunction is (= min), disjunction (= max), and neg the order-reversing involution.

Instances For
    @[implicit_reducible]
    Equations
    def instReprTrivalent.repr :
    TrivalentStd.Format
    Equations
    Instances For
      @[implicit_reducible]
      instance instDecidableEqTrivalent :
      DecidableEq Trivalent
      Equations
      @[implicit_reducible]
      instance instInhabitedTrivalent :
      Inhabited Trivalent
      Equations
      @[implicit_reducible]
      Equations

      The truth order #

      The less-than-or-equal relation on truth values: false < indet < true.

      Instances For
        @[implicit_reducible]
        Equations
        @[implicit_reducible]
        instance Trivalent.instDecidableLE :
        DecidableLE Trivalent
        Equations
        • One or more equations did not get rendered due to their size.
        @[implicit_reducible]
        instance Trivalent.instLinearOrder :
        LinearOrder Trivalent
        Equations
        • One or more equations did not get rendered due to their size.
        @[implicit_reducible]
        instance Trivalent.instBoundedOrder :
        BoundedOrder Trivalent
        Equations

        Strong Kleene negation #

        Strong Kleene meet/join on a chain ARE min/max = /; use the mathlib operations directly. Negation is the remaining primitive.

        Strong Kleene negation: the order-reversing involution swapping false and true, fixing indet.

        Equations
        Instances For
          @[simp]
          theorem Trivalent.neg_neg (a : Trivalent) :
          a.neg.neg = a
          theorem Trivalent.neg_involutive :
          Function.Involutive neg
          theorem Trivalent.neg_antitone :
          Antitone neg

          Strong Kleene negation is antitone (order-reversing).

          @[simp]
          theorem Trivalent.neg_inf (a b : Trivalent) :
          (min a b).neg = max a.neg b.neg

          De Morgan: negation swaps meet and join — from antitonicity alone.

          @[simp]
          theorem Trivalent.neg_sup (a b : Trivalent) :
          (max a b).neg = min a.neg b.neg

          De Morgan: negation swaps join and meet.

          theorem Trivalent.inf_neg_le_sup_neg (a b : Trivalent) :
          min a a.neg max b b.neg

          The Kleene law a ⊓ ¬a ≤ b ⊔ ¬b.

          @[implicit_reducible]
          Equations
          @[implicit_reducible]

          Trivalent is the canonical non-Boolean Kleene algebra (Order.KleeneAlgebra): a distributive chain with neg as the involutive antitone complement, failing complementation (inf_compl_indet_ne_bot). The instance gives access to the class API (Core/Order/DeMorganAlgebra/Defs.lean); neg remains the simp-normal form.

          Equations
          • One or more equations did not get rendered due to their size.

          Trivalent is not complemented — indet witnesses the gap between Kleene and Boolean (so Trivalent is no OrthocomplementedLattice either).

          Constructor-literal simp lemmas #

          Inherited from BoundedOrder + Lattice + LinearOrder, restated with the constructor literals (⊤ = .true, ⊥ = .false) that goals actually mention.

          @[simp]
          theorem Trivalent.sup_true (a : Trivalent) :
          max a true = true
          @[simp]
          theorem Trivalent.true_sup (a : Trivalent) :
          max true a = true
          @[simp]
          theorem Trivalent.inf_false (a : Trivalent) :
          min a false = false
          @[simp]
          theorem Trivalent.false_inf (a : Trivalent) :
          min false a = false
          theorem Trivalent.indet_inf (a : Trivalent) (h : a false) :
          min indet a = indet

          indet propagates through unless dominated by false.

          theorem Trivalent.indet_sup (a : Trivalent) (h : a true) :
          max indet a = indet

          indet propagates through unless dominated by true.

          Designated values #

          Matrix semantics fixes an upward-closed set of designated values; on a chain every such set is principal, so a designation standard is just a threshold. K3 (strong Kleene) designates {.true} and preserves truth; LP (Priest's Logic of Paradox) designates {.indet, .true} and preserves non-falsity ([CERvR12]). Same algebra, dual logics — and every designation law is an order law.

          A designation standard, identified by its least designated value (threshold).

          Instances For
            Equations
            Instances For
              @[implicit_reducible]
              Equations

              v is designated at d iff it clears the threshold — the designated set is the principal filter above d.threshold.

              Equations
              Instances For
                @[simp]

                K3-designation is truth.

                @[simp]

                LP-designation is non-falsity.

                K3/LP duality via negation: negation swaps the standards (the antitone involution neg fixes indet, exchanging the two principal filters' complements).

                theorem Trivalent.designated_inf (d : Designation) (v w : Trivalent) :
                designated d (min v w) designated d v designated d w

                Designation distributes over : the designated set is a filter (le_inf_iff).

                theorem Trivalent.designated_sup (d : Designation) (v w : Trivalent) :
                designated d (max v w) designated d v designated d w

                Designation distributes over : thresholds are prime on a chain (le_sup_iff).

                K3 is the stronger standard: its threshold dominates LP's.

                Conversion from Bool #

                The two-valued fragment: Bool.true ↦ .true, Bool.false ↦ .false.

                Equations
                Instances For
                  @[implicit_reducible]
                  instance Trivalent.instCoeBool :
                  Coe Bool Trivalent
                  Equations

                  A value is defined when it is not indet.

                  Equations
                  Instances For
                    @[implicit_reducible]
                    Equations
                    • One or more equations did not get rendered due to their size.

                    Project to Bool, sending indet to false.

                    Equations
                    Instances For
                      @[simp]
                      theorem Trivalent.ofBool_inf (a b : Bool) :
                      min (ofBool a) (ofBool b) = ofBool (a && b)

                      Trivalent.ofBool preserves /&&.

                      @[simp]
                      theorem Trivalent.ofBool_sup (a b : Bool) :
                      max (ofBool a) (ofBool b) = ofBool (a || b)

                      Trivalent.ofBool preserves /||.

                      theorem Trivalent.neg_ofBool (a : Bool) :
                      (ofBool a).neg = ofBool !a

                      Negation agrees with Bool.

                      theorem Trivalent.designated_ofBool (d : Designation) (b : Bool) :
                      designated d (ofBool b) b = Bool.true

                      The designation standards agree on the two-valued fragment.

                      def Trivalent.ofBoolHom :
                      BoundedLatticeHom Bool Trivalent

                      Trivalent.ofBool as a bounded lattice homomorphism, onto the {⊥, ⊤} sublattice of Trivalent — so consumers can appeal to the general LatticeHom API.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For

                        Exclusive disjunction #

                        Strong Kleene exclusive disjunction: true when exactly one operand is true, undefined when either operand is. Unlike , XOR cannot "see past" an undefined operand — .true ⊔ .indet = .true, but xor .true .indet = .indet ([WD26], Figure 2).

                        Equations
                        Instances For
                          theorem Trivalent.xor_comm (a b : Trivalent) :
                          a.xor b = b.xor a

                          XOR is commutative.

                          theorem Trivalent.xor_eq_sup_inf_neg (a b : Trivalent) :
                          a.xor b = min (max a b) (min a b).neg

                          XOR decomposes as (a ∨ b) ∧ ¬(a ∧ b) under Strong Kleene.

                          XOR propagates indet unconditionally from the left.

                          XOR propagates indet unconditionally from the right.

                          theorem Trivalent.xor_ofBool (a b : Bool) :
                          (ofBool a).xor (ofBool b) = ofBool (a ^^ b)

                          XOR agrees with Bool XOR on defined inputs.

                          theorem Trivalent.xor_indet_iff (a b : Trivalent) :
                          a.xor b = indet a = indet b = indet

                          XOR is undefined iff at least one operand is — so exclusive disjunction never filters undefinedness, in contrast with (.true ⊔ .indet = .true) ([WD26]).

                          The truth order as SignType #

                          Mathlib's carrier for a three-element chain with an involutive order-reversing negation fixing the midpoint is SignType (-1 < 0 < 1).

                          The truth-order carrier iso: false ↔ -1, indet ↔ 0, true ↔ 1, with Kleene negation corresponding to SignType negation (orderIsoSignType_neg). The knowledge-order counterpart is equivFlatBool.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For

                            SignType multiplication transports to the Strong Kleene biconditional, so Trivalent.xor is its negation.

                            Weak Kleene and the Beaver-Krahmer operators #

                            The Weak Kleene "internal" connectives originate with [Boc37] (Russian original; English translation by Bergmann 1981) and are discussed by [Kle52]: indet propagates unconditionally, matching Bochvar's "nonsense" reading of paradox-prone statements. metaAssert and presuppose are the 𝒜 and ∂ operators of [BK01] §2.

                            Meta-assertion: the 𝒜 (assertion) operator of [BK01] §2, closing a trivalent value to bivalent by treating undefinedness as falsity.

                            Equations
                            Instances For

                              Meta-assertion always produces a defined value.

                              Meta-assertion is idempotent.

                              Meta-assertion preserves defined values.

                              Presupposition: the ∂ operator of [BK01] §2, the companion of metaAssert — asserts a true value, undefined otherwise (T ↦ T, F ↦ #, # ↦ #).

                              Equations
                              Instances For

                                Meta-asserting a presupposed value falsifies undefinedness: 𝒜 ∘ ∂ sends exactly .true to .true.

                                Middle Kleene #

                                The asymmetric left-to-right connectives of [Pet79], the trivalent face of Karttunen filtering ([BK01], [Spe25]): an undefined first operand absorbs; a defined one proceeds by Strong Kleene.

                                Middle Kleene conjunction: left-undefined absorbs, left-defined proceeds by Strong Kleene. Asymmetric — meetMiddle .false .indet = .false but meetMiddle .indet .false = .indet ([Pet79]).

                                Equations
                                Instances For

                                  Middle Kleene disjunction: left-undefined absorbs, left-defined proceeds by Strong Kleene — a defined first disjunct can settle the result even when the second is undefined, the left-to-right filtering pattern ([Pet79]).

                                  Equations
                                  Instances For

                                    Middle Kleene conjunction is not commutative.

                                    Middle Kleene disjunction is not commutative.

                                    When the left operand is defined, Middle Kleene conjunction equals Strong Kleene.

                                    When the left operand is defined, Middle Kleene disjunction equals Strong Kleene.

                                    Left-undefined absorbs Middle Kleene conjunction.

                                    Left-undefined absorbs Middle Kleene disjunction.

                                    true is a left identity for Middle Kleene conjunction.

                                    false is a left zero for Middle Kleene conjunction — the key asymmetry against Weak Kleene, where meetWeak .false .indet = .indet.

                                    false is a left identity for Middle Kleene disjunction.

                                    theorem Trivalent.meetMiddle_ofBool (a b : Bool) :
                                    (ofBool a).meetMiddle (ofBool b) = ofBool (a && b)

                                    Middle Kleene conjunction agrees with Bool on defined inputs.

                                    theorem Trivalent.joinMiddle_ofBool (a b : Bool) :
                                    (ofBool a).joinMiddle (ofBool b) = ofBool (a || b)

                                    Middle Kleene disjunction agrees with Bool on defined inputs.

                                    Belnap conditional assertion #

                                    [Bel70]'s connectives skip undefined operands: a compound is assertive iff at least one operand is, and asserts the combination of the assertive operands only — indet is the identity element. Contrast Strong Kleene (indet propagates unless dominated) and Weak Kleene (indet always propagates).

                                    Belnap conjunction: undefined operands are skipped; indet is the identity ([Bel70], (8)).

                                    Equations
                                    Instances For

                                      Belnap disjunction: undefined operands are skipped; indet is the identity ([Bel70], (9)).

                                      Equations
                                      Instances For

                                        indet is a left identity for Belnap conjunction.

                                        indet is a right identity for Belnap conjunction.

                                        Belnap conjunction is commutative.

                                        indet is a left identity for Belnap disjunction.

                                        indet is a right identity for Belnap disjunction.

                                        Belnap disjunction is commutative.

                                        theorem Trivalent.meetBelnap_ofBool (a b : Bool) :
                                        (ofBool a).meetBelnap (ofBool b) = ofBool (a && b)

                                        Belnap conjunction agrees with Bool on defined inputs.

                                        theorem Trivalent.joinBelnap_ofBool (a b : Bool) :
                                        (ofBool a).joinBelnap (ofBool b) = ofBool (a || b)

                                        Belnap disjunction agrees with Bool on defined inputs.

                                        Projection behaviour #

                                        How truth values aggregate through an operator: conjunctive (universal-like, all must succeed) or disjunctive (existential-like, one must succeed).

                                        Instances For
                                          Equations
                                          • One or more equations did not get rendered due to their size.
                                          Instances For
                                            @[implicit_reducible]
                                            Equations